zyra / cordova-plugin-stripe

A Cordova plugin that lets you use Stripe's Native SDKs for Android and iOS.
MIT License
93 stars 57 forks source link

Android Build Error with stripe-android >= 3.1.0 #25

Closed mwiley63 closed 7 years ago

mwiley63 commented 7 years ago

I am receiving the following build error with any stripe-android version >= 3.1.0 in my project.properties.

Here is the error:

.../platforms/android/gradlew: Command failed with exit code 1 Error output:
.../app/platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

.../blowout/app/platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

.../platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:3: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

.../platforms/android/build/intermediates/res/merged/debug/values-v24/values-v24.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

My ionic info:

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1 
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 6.2.3 browser 4.1.0 ios 4.4.0
    Ionic Framework                 : ionic-angular 3.4.2

System:

    Node       : v7.4.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b 
    ios-deploy : 1.9.1 
    ios-sim    : 5.0.13 
    npm        : 4.0.5 

My project.properties:

target=android-25
android.library.reference.1=CordovaLib
cordova.gradle.include.1=card.io.cordova.mobilesdk/blosher-build.gradle
cordova.gradle.include.2=com.paypal.cordova.mobilesdk/blosher-build.gradle
cordova.system.library.1=com.android.support:appcompat-v7:24+
cordova.gradle.include.3=com.synconset.imagepicker/blosher-ignorelinterrors.gradle
cordova.gradle.include.4=com.synconset.imagepicker/blosher-androidtarget.gradle
cordova.system.library.2=com.android.support:support-v4:24.1.1+
cordova.system.library.3=com.facebook.android:facebook-android-sdk:4.14.+
cordova.system.library.4=com.google.android.gms:play-services-maps:+
cordova.system.library.5=com.google.android.gms:play-services-location:+
cordova.gradle.include.5=phonegap-plugin-push/blosher-push.gradle
cordova.system.library.6=com.android.support:support-v13:24+
cordova.system.library.7=com.google.android.gms:play-services-gcm:+
cordova.system.library.8=me.leolin:ShortcutBadger:1.1.14@aar
cordova.system.library.9=com.stripe:stripe-android:3.1.0

I have all SDKs and tools installed for versions 22-26. Is there something I am missing?

ihadeed commented 7 years ago

The latest version of this plugin uses stripe-android:4.1.2. Their package doesn't have any Android Support library dependencies, so I'm not sure if this can cause any problems.

Try to remove platforms and plugins directories and re-install them. There might be some left-over code that's causing issues. Also, make sure to install latest version of android and latest version of this plugin.

mwiley63 commented 7 years ago

I think they do use a support library, at least it looks like it according to this post: https://github.com/stripe/stripe-android/pull/82

I updated cordova and cordova-android. Removed the android platform and re-added it.

Here is a list of my plugins:

card.io.cordova.mobilesdk 2.1.0 "CardIO"
com.googlemaps.ios 2.2.0 "Google Maps SDK for iOS"
com.paypal.cordova.mobilesdk 3.5.0 "PayPalMobile"
com.synconset.imagepicker 2.1.7 "ImagePicker"
cordova-plugin-camera 2.4.1 "Camera"
cordova-plugin-compat 1.1.0 "Compat"
cordova-plugin-device 1.1.5 "Device"
cordova-plugin-email 1.2.6 "EmailComposer"
cordova-plugin-facebook4 1.7.4 "Facebook Connect"
cordova-plugin-file 4.3.2 "File"
cordova-plugin-file-transfer 1.6.2 "File Transfer"
cordova-plugin-geolocation 2.4.2 "Geolocation"
cordova-plugin-globalization 1.0.6 "Globalization"
cordova-plugin-googlemaps 1.4.0 "phonegap-googlemaps-plugin"
cordova-plugin-inappbrowser 1.7.1 "InAppBrowser"
cordova-plugin-keyboard 1.1.5 "Keyboard"
cordova-plugin-splashscreen 4.0.2 "Splashscreen"
cordova-plugin-statusbar 2.2.2 "StatusBar"
cordova-plugin-stripe 1.5.3 "cordova-plugin-stripe"
cordova-plugin-whitelist 1.3.2 "Whitelist"
cordova-plugin-wkwebview-engine 1.1.3-dev "Cordova WKWebView Engine"
cordova-sqlite-storage 2.0.4 "Cordova sqlite storage plugin"
ionic-plugin-deploy 0.6.6 "IonicDeploy"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 1.10.2 "PushPlugin"

And the build fails. If I do a ionic cordova plugin rm cordova-plugin-stripe and ionic cordova build android my application builds successfully.

If I find a solution I will update this issue.

Thanks!

ihadeed commented 7 years ago

I didn't have any trouble building two different apps. One of them is ionic-native-playground which uses lots of plugins.

I found a few related SO posts on Google, check them out they might have something related.

mwiley63 commented 7 years ago

Yes, it's not something with this plugin, but rather the combination of plugins I am using.

Thanks for the pointers!

brittonk commented 5 years ago

I'm having this same issue but not using ionic. I've tried removing plugins and adding them but cannot find the conflicting plugin.

BUILD FAILED

Total time: 6.631 secs

1>MSBUILD : cordova-build error : D:\WooHim\WooHim\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. 1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception. 1>MSBUILD : cordova-build error : What went wrong: 1>MSBUILD : cordova-build error : Execution failed for task ':processDebugResources'. 1>MSBUILD : cordova-build error : > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\ProgramData\Microsoft\AndroidSDK\25\build-tools\27.0.3\aapt.exe'' finished with non-zero exit value 1 1>MSBUILD : cordova-build error : Try: 1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Command finished with error code 1: cmd /s /c "D:\WooHim\WooHim\platforms\android\gradlew.bat cdvBuildDebug -b D:\WooHim\WooHim\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true" 1>MSBUILD : cordova-build error : Error: cmd: Command failed with exit code 1 Error output:

1>MSBUILD : cordova-build error : D:\WooHim\WooHim\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:3: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. 1>MSBUILD : cordova-build error : D:\WooHim\WooHim\platforms\android\build\intermediates\res\merged\debug\values-v24\values-v24.xml:4: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. 1>MSBUILD : cordova-build error : FAILURE: Build failed with an exception. 1>MSBUILD : cordova-build error : What went wrong: 1>MSBUILD : cordova-build error : Execution failed for task ':processDebugResources'. 1>MSBUILD : cordova-build error : > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\ProgramData\Microsoft\AndroidSDK\25\build-tools\27.0.3\aapt.exe'' finished with non-zero exit value 1 1>MSBUILD : cordova-build error : Try: 1>MSBUILD : cordova-build error : Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 1>MSBUILD : cordova-build error : Picked up _JAVA_OPTIONS: -Xmx512M 1>Done building project "WooHim.jsproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== ========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

brittonk commented 5 years ago

Googling and trial and error led me to change the following in the build.gradle for Android.

I commented out the lines and hardcoded the versions to use. It seems anything 23 or below... which I guess is what Visual Studio is filling... breaks this plugin. Opening Android SDK Manager I found an installed version of Build Tools greater than that and used it. The error went away and the project now builds with this stripe plugin.

My change:

//compileSdkVersion cdvCompileSdkVersion
//buildToolsVersion cdvBuildToolsVersion
compileSdkVersion 25
buildToolsVersion "25.0.3"