简体   繁体   English

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

[英]Deprecated Gradle features were used in this build, making it incompatible with Gradle 6

I try to get Apk in react-native however it doesn't give me anything.我尝试在 react-native 中获取 Apk,但是它没有给我任何东西。 release file which is in Apk file is empty and after Gradlew bundle release is finished, it says Apk 文件中的 release 文件是空的,在 Gradlew bundle 发布完成后,它说

    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

I couldn't find how to solve this issue我找不到如何解决这个问题

    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 version "12.0.1" 2019-04-16 node -v v10.16.0 npm -v 6.9.0 java 版本“12.0.1” 2019-04-16 node -v v10.16.0 npm -v 6.9.0

Have you tried running ./gradlew bundleRelease --warning-mode all ?你试过运行./gradlew bundleRelease --warning-mode all吗?

It will give you more info on what are incompatible.它将为您提供有关不兼容内容的更多信息。

This happened to me in a React Native project.这发生在我的 React Native 项目中。 This is the step-by-step to fix it in Windows (10 64bits):这是在 Windows(10 64 位)中逐步修复它的步骤:

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

2) In another console run in your project gradle wrapper (you must to have installed Gradle 5.4.1 ( https://gradle.org/install/ )) 2)在另一个控制台中运行您的项目gradle wrapper (您必须安装 Gradle 5.4.1 ( https://gradle.org/install/ ))

3) Then move to cd android , here run gradlew clean 3)然后移动到cd android ,在这里运行gradlew clean

4) Move to root cd.. and run react-native start 4) 移动到 root cd..并运行react-native start

5) In another console run in your project react-native run-android 5)在你的项目中的另一个控制台中运行react-native run-android

In 2020 if you have the same issue, this suggestion by the Powershell has helped me.在 2020 年,如果您遇到同样的问题,Powershell 的这个建议对我有帮助。

.\\emulator.exe -avd "MyAvd" .\\emulator.exe -avd "MyAvd"

Run the above command in the directory, where your SDK emulator is located (C:\\Users\\AppData\\Local\\Android\\Sdk\\emulator) and then you might get some instructions as I received below:在您的 SDK 模拟器所在的目录 (C:\\Users\\AppData\\Local\\Android\\Sdk\\emulator) 中运行上述命令,然后您可能会得到一些说明,如下所示:

Your emulator is out of date, please update by launching Android Studio:您的模拟器已过期,请通过启动 Android Studio 进行更新:

  • Start Android Studio启动 Android Studio
  • Select menu "Tools > Android > SDK Manager"选择菜单“工具 > Android > SDK 管理器”
  • Click "SDK Tools" tab单击“SDK 工具”选项卡
  • Check "Android Emulator" checkbox选中“Android 模拟器”复选框
  • Click "OK"点击“确定”

This link would be helpful too.这个链接也会有帮助。 link 关联

  1. Go to project file run gradle wrapper .转到项目文件运行gradle wrapper
  2. Then move to cd android, here run gradle clean .然后移动到 cd android,在这里运行gradle clean
  3. Move to root "cd.." and run react-native start .移至 root "cd.." 并运行react-native start
  4. In another console run in your project react-native run-android在您的项目中的另一个控制台中运行react-native run-android

Your project will be running!您的项目将运行!

To solve the problem you need to locate this file (gradle-wrapper.properties) The file is located in d path (android/gradle/wrapper) in your project folder....open the file and change this line要解决此问题,您需要找到此文件(gradle-wrapper.properties)该文件位于项目文件夹中的 d 路径(android/gradle/wrapper)....打开文件并更改此行

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

to this:对此:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 5.0 不兼容 - Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 此版本中使用了已弃用的 Gradle 功能,使其与 Gradle X 不兼容 - Deprecated Gradle features were used in this build, making it incompatible with Gradle X 当我执行 gradle lint 时出现错误“此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 6.0 不兼容” - Error "Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0" When I do gradle lint Unity Android 构建错误 - 此构建中使用了已弃用的 Gradle 功能,使其与 Gradle 6.0 不兼容 - Error on Unity Android Build - Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0 Gitlab CI / CD显示在此版本中使用了不推荐使用的Gradle功能,使其与Gradle 5.0不兼容 - Gitlab CI/CD Show Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0 React Native:Task:app:installDebug FAILED Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0 - React Native : Task :app:installDebug FAILED Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0 “此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 7.0 不兼容。” -反应原生 - "Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0." -REACT-NATIVE Task:app:mergeReleaseResources FAILED, Deprecated Gradle features used in this build, 使其与 Gradle 7.0 不兼容 - Task :app:mergeReleaseResources FAILED, Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0 此版本中使用了已弃用的 Gradle 功能,使其与 Gradle 6.0 不兼容。 - 反应原生 - Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. - React native React Native Task :app:processDebugResources FAILED 已弃用的 Gradle 功能在此构建中使用,使其与 Gradle 7.0 不兼容 - React native Task :app:processDebugResources FAILED Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM