无法从React Native建立发布APK

时间:2018-07-03 21:31:15

标签: android react-native gradlew

我使用react native开发了一个应用程序,但是我对原生iOS或Android并不了解很多。我已经发布了适用于iOS的应用程序,但是,由于我正在尝试为Google Play商店做同样的事情,因此遇到了一些我不知道如何解决的问题。 我正在按照the official react native website的说明进行操作,但是无法通过$ ./gradlew assembleRelease步骤。我修复了一些错误,但现在使用--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

我不知道问题是否直接与braintree xplat library或其他问题有关。

任何帮助将不胜感激。

Edit1:

这里显示了我对./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

1 个答案:

答案 0 :(得分:1)

好吧,我终于通过更新braintree xplat库的build.gradle解决了这个问题。然后其他库显示相同的错误,因此我必须手动更新每个库的build.gradle文件。

这只会暂时解决我的问题,因为如果我删除node_modules文件夹并运行npm install,它将被覆盖。或者,如果有人克隆了该项目。