我有一个gradle FAILURE:

..."Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0."

案例描述:

附加到项目代码库的下一个库:

APP / build.gradle

    //(Required) Writing and executing Unit Tests on the JUnit Platform 
testImplementation "org.junit.jupiter:junit-jupiter-api:5.2.0"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.2.0"
    // (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.2.0"
    // (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.2.0"

testImplementation "io.mockk:mockk:1.8.5"

更新gradle-wrapper.properties distributionUrl=https....gradle-4.4-all.zip到4.7-all .zip 毕竟,gradle是建立成功的 创建测试类 @TestInstance (TestInstance.Lifecycle.PER_CLASS) 类TestClass { @Test 内部乐趣testName() { 断言。assertEquals(2,1 + 1) } } 运行测试并得到FAILURE消息。 运行Gradle构建时使用命令行参数./gradlew——warning-mode=all来查看哪些特性被弃用了。

结果,我无法构建应用程序,我得到了FAILURE:消息。


当前回答

对我来说,问题是我的设备内部存储空间用完了。在删除了一些不必要的应用程序后,它运行正常。

其他回答

在react-native的项目中,它为我在这个问题上工作:

在此版本中使用了已弃用的Gradle特性,使其与Gradle 7.0不兼容。

244个可操作任务:2个已执行,242个最新 D8:无法将请求的类放入单个dex文件(# fields: 67296 > 65536) 合并dex档案时出现错误: .dex文件中方法引用的个数不能超过64K。 请登录https://developer.android.com/tools/building/multidex.html了解如何解决此问题 ....

我是这样做的:

从我的设备上卸载应用程序: .dex文件中方法引用的数量不能超过64k API 17

我正在使用react-native,这适用于我:

在项目CD的根android和gradlew清理 在Windows中打开任务管理器 在tab 'Details'上点击java.exe进程的endtask

长话短说 >任务:app:installDebug FAILED通过杀死java.exe进程修复

在上面的答案对我都不起作用后,我设法通过将Gradle插件升级到最新版本并使用JDK 11来解决这个问题。 希望这能帮助到一些人!

试试这个

cd android && ./gradlew clean && ./gradlew :app:bundleRelease

从设备/模拟器卸载旧的应用程序。这对我很有效