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

时间:2019-06-23 17:41:32

标签: android react-native gradle build.gradle react-native-cli

我试图使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

5 个答案:

答案 0 :(得分:1)

在2020年,如果您遇到同样的问题,Powershell的建议对我有所帮助。

。\ emulator.exe -avd“ MyAvd”

在SDK模拟器所在的目录(C:\ Users \ AppData \ Local \ Android \ Sdk \ emulator)中运行上述命令,然后您可能会收到一些如下所示的说明:

您的模拟器已过时,请通过启动Android Studio进行更新:

  • 启动Android Studio
  • 选择菜单“工具> Android> SDK管理器”
  • 点击“ SDK工具”标签
  • 选中“ Android Emulator”复选框
  • 点击“确定”

此链接也将很有帮助。 link

答案 1 :(得分:0)

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

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

答案 2 :(得分:0)

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

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

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中运行的另一个控制台中

答案 3 :(得分:0)

  1. 转到项目文件运行gradle wrapper
  2. 然后移至cd android,在这里运行gradle clean
  3. 移动到根目录“ cd ..”并运行react-native start
  4. 在项目react-native run-android中运行的另一个控制台中

您的项目将开始运行!

答案 4 :(得分:0)

要解决此问题,您需要找到此文件(gradle-wrapper.properties)。该文件位于项目文件夹中的d路径(android / gradle / wrapper)中。...打开文件并更改此行< / p>

distributionUrl=https://services.gradle.org/distributions/gradle-5.5-all.zip 

对此:

distributionUrl=https://services.gradle.org/distributions/gradle-6.0.1-all.zip