miguelglz
miguelglz

Reputation: 447

Can't build release APK from react native

I developed an app using react native, and I don't have a lot of knowledge about native iOS or Android. I have already released my app for iOS, however, now that I'm trying to do the same thing for the Google Play Store I'm facing some problems that I don't know how to solve. I'm following the instructions from the official react native website, but can't get pass the $ ./gradlew assembleRelease step. I fixed some errors but now I get the following when running the command with --info :

> Task :react-native-braintree-xplat:verifyReleaseResources FAILED
Putting task artifact state for task ':react-native-braintree-xplat:verifyReleaseResources' into context took 0.0 secs.
Up-to-date check for task ':react-native-braintree-xplat:verifyReleaseResources' took 0.0 secs. It is not up-to-date because:
  Task has failed previously.
All input files are considered out-of-date for incremental task ':react-native-braintree-xplat:verifyReleaseResources'.
Unable do incremental execution: full task run
QueuedCruncher is using /Users/miguel/Library/Android/sdk/build-tools/27.0.3/aapt

Shutdown finished in 0ms

:react-native-braintree-xplat:verifyReleaseResources (Thread[Task worker for ':' Thread 3,5,main]) completed. Took 0.7 secs.
:react-native-svg:platformAttrExtractor (Thread[Task worker for ':',5,main]) completed. Took 10.698 secs.
:react-native-vector-icons:platformAttrExtractor (Thread[Daemon worker Thread 23,5,main]) completed. Took 10.461 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-braintree-xplat:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 5m 19s
173 actionable tasks: 152 executed, 21 up-to-date

I don't know if the problem is directly with the braintree xplat library or something else.

Any help would be appreciated.

Edit1:

Heres my output for ./gradlew clean assembleRelease:

Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :app 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease]
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)

> Configure project :react-native-braintree-xplat 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :react-native-fast-image 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :react-native-fcm 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :react-native-image-crop-picker 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (27.0.0) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '27.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Download https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml

> Configure project :react-native-image-picker 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testCompile' is obsolete and has been replaced with 'testImplementation' and 'testApi'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: Configuration 'testApi' is obsolete and has been replaced with 'testImplementation'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (25.0.2) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '25.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :react-native-linear-gradient 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'provided' is obsolete and has been replaced with 'compileOnly'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :react-native-svg 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Configure project :react-native-vector-icons 
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.3.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

> Task :react-native-fast-image:processReleaseManifest 
/Users/miguel/Projects/main/app/node_modules/react-native-fast-image/android/src/main/AndroidManifest.xml:11:9-15:15 Warning:
        meta-data#com.bumptech.glide.integration.okhttp.OkHttpGlideModule was tagged at AndroidManifest.xml:11 to remove other declarations but no other declaration present

Download https://jcenter.bintray.com/com/braintreepayments/api/braintree/maven-metadata.xml
Download https://jcenter.bintray.com/com/braintreepayments/api/drop-in/maven-metadata.xml

> Task :app:processReleaseGoogleServices 
Parsing json file: /Users/miguel/Projects/main/app/android/app/google-services.json

> Task :app:bundleReleaseJsAndAssets 
Scanning folders for symlinks in /Users/miguel/Projects/main/app/node_modules (20ms)
Scanning folders for symlinks in /Users/miguel/Projects/main/app/node_modules (15ms)
Loading dependency graph, done.
warning: the transform cache was reset.
bundle: Writing bundle output to: /Users/miguel/Projects/main/app/android/app/build/intermediates/assets/release/index.android.bundle
bundle: Done writing bundle output
bundle: Copying 73 asset files
bundle: Done copying assets

> Task :app:processReleaseManifest 
/Users/miguel/Projects/main/app/android/app/src/main/AndroidManifest.xml:16:9-19:35 Warning:
        meta-data#com.bumptech.glide.integration.okhttp.OkHttpGlideModule was tagged at AndroidManifest.xml:16 to remove other declarations but no other declaration present

> Task :react-native-braintree-xplat:compileReleaseJavaWithJavac 
Note: /Users/miguel/Projects/main/app/node_modules/react-native-braintree-xplat/android/src/main/java/com/pw/droplet/braintree/Braintree.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-fcm:compileReleaseJavaWithJavac 
Note: /Users/miguel/Projects/main/app/node_modules/react-native-fcm/android/src/main/java/com/evollu/react/fcm/SendNotificationTask.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-image-crop-picker:compileReleaseJavaWithJavac 
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :react-native-svg:compileReleaseJavaWithJavac 
Note: /Users/miguel/Projects/main/app/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/RenderableShadowNode.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

/Users/miguel/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.0.aar/4d424ba56bd7e2658a57959457dfb2f2/res/values-v24/values-v24.xml:3:5-157: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.

/Users/miguel/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.0.aar/4d424ba56bd7e2658a57959457dfb2f2/res/values-v24/values-v24.xml:4:5-135: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.

/Users/miguel/.gradle/caches/transforms-1/files-1.1/appcompat-v7-27.0.0.aar/4d424ba56bd7e2658a57959457dfb2f2/res/values-v26/values-v26.xml:13:5-16:13: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-braintree-xplat:verifyReleaseResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 6m 36s
185 actionable tasks: 175 executed, 10 up-to-date

Upvotes: 2

Views: 2263

Answers (1)

miguelglz
miguelglz

Reputation: 447

Ok I finally fixed this problem by updating the build.gradle of the braintree xplat library. Then other libraries showed the same error so I had to manually update the build.gradle file of each library.

This will only solve my problem temporary as it will be overwritten if I delete my node_modules folder and run npm install. Or if somebody else clones the project.

Upvotes: 1

Related Questions