此版本中使用了弃用的 Gradle 功能,使其与 Gradle 6 不兼容

新手上路,请多包涵

我尝试在 react-native 中获取 Apk,但它没有给我任何东西。 Apk 文件中的发布文件为空,在 Gradlew 捆绑发布完成后,它说

    Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

我找不到如何解决这个问题

    react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details
> Task :app:transformClassesWithDexBuilderForDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> java.nio.file.AccessDeniedException: /home/kourosh/Projects/FitnessApp/android/app/build/intermediates/transforms/dexBuilder/debug/45/androidx/versionedparcelable/R.dex

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 1m 15s
19 actionable tasks: 1 executed, 18 up-to-date
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.

java版本“12.0.1”2019-04-16节点-v v10.16.0 npm -v 6.9.0

原文由 Kourosh Neyestani 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 773
2 个回答

这发生在我的一个 React Native 项目中。这是在 Windows(10 64 位)中修复它的分步操作:

  1. 在没有 Android Studio 的情况下运行 avd ( https://windowsloop.com/launch-avd-manager-without-android-studio/ )

2)在你的项目中运行另一个控制台 gradle wrapper (你必须已经安装了Gradle 5.4.1( https://gradle.org/install/ ))

3)然后移动到 cd android ,这里运行 gradlew clean

4)移动到根目录 cd.. 并运行 react-native start

5)在您的项目中运行的另一个控制台 react-native run-android

原文由 Ulises Vargas De Sousa 发布,翻译遵循 CC BY-SA 4.0 许可协议

您是否尝试过运行 ./gradlew bundleRelease --warning-mode all

它将为您提供有关不兼容内容的更多信息。

原文由 silverr 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题