在 React Native 0.64.0 上构建 android 失败

时间:2021-03-17 10:48:29

标签: android react-native gradle proguard android-r8

我的发布版本因这些日志而失败。 不确定这里发生了什么。可能与 Android R8 或 Gradle 4.1.0 有关。 我试过删除 node_modules .gradle app/build build 我试图清理,重建,使缓存无效并重新启动。它们似乎都不起作用。

我非常感谢您的帮助。


> Task :app:minifyReleaseProductionWithR8 FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
991 actionable tasks: 10 executed, 981 up-to-date
myapp/android/app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/releaseProduction/R.jar: R8: Type androidx.transition.R is defined multiple times: myapp/android/app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/releaseProduction/R.jar:androidx/transition/R.class, myapp/android/app/build/intermediates/javac/releaseProduction/classes/androidx/transition/R.class

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyReleaseProductionWithR8'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: myapp/android/app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/releaseProduction/R.jar:androidx/transition/R.class

* 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 1m 9s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: ./gradlew app:installReleaseProduction -PreactNativeDevServerPort=8081
myapp/android/app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/releaseProduction/R.jar: R8: Type androidx.transition.R is defined multiple times: myapp/android/app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/releaseProduction/R.jar:androidx/transition/R.class, myapp/android/app/build/intermediates/javac/releaseProduction/classes/androidx/transition/R.class

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:minifyReleaseProductionWithR8'.
> com.android.tools.r8.CompilationFailedException: Compilation failed to complete, origin: myapp/android/app/build/intermediates/compile_and_runtime_not_namespaced_r_class_jar/releaseProduction/R.jar:androidx/transition/R.class

* 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 1m 9s

    at makeError (myapp/node_modules/execa/index.js:174:9)
    at myapp/node_modules/execa/index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async runOnAllDevices (myapp/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
    at async Command.handleAction (myapp/node_modules/@react-native-community/cli/build/index.js:186:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

0 个答案:

没有答案