我有一个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:消息。


当前回答

在我的例子中,我更新了构建。并将类路径设置为3.5.2到3.6.3的最新版本

dependencies {
        classpath("com.android.tools.build:gradle:3.6.3") 
    }

其他回答

更新第三方依赖项。例如,我更新了依赖 实现“com.github.ybq:Android-SpinKit:1.1.0”到实现“com.github.ybq:Android-SpinKit:1.2.0”。对我来说,问题已经解决了。

下面的解决方案帮助了我,因为我也得到了相同的警告。 在你的项目级gradle文件中,尝试在类路径中更改gradle版本

classpath "com.android.tools.build:gradle:3.6.0" to
classpath "com.android.tools.build:gradle:4.0.1"

在我的情况下,从基本目录删除整个android文件夹,并允许它在eas build上重建所有它修复了这个错误:)

在gradle-wrapper-properties文件中设置distributionUrl路径为:

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

在我的情况下,在Android/app/build中添加multiDexEnabled true。Gradle文件编译文件。

我将考虑在未来删除这个,因为在文档中它说“在配置你的应用程序以启用64K或更多的方法引用之前,你应该采取措施减少你的应用程序代码调用的引用总数,包括你的应用程序代码定义的方法或包含的库。”

defaultConfig {
  applicationId "com.peoplesenergyapp"
  minSdkVersion rootProject.ext.minSdkVersion
  targetSdkVersion rootProject.ext.targetSdkVersion
  versionCode 1
  versionName "1.0"
  multiDexEnabled true // <-add this 
}