我遇到了Gradle构建失败的问题:
..."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
完成所有Gradle的构建后成功了
创建了测试类
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class TestClass {
@Test
internal fun testName() {
Assert.assertEquals(2, 1 + 1)
}
}
通过命令行参数./gradlew --warning-mode=all
运行Gradle构建,以查看哪些已弃用的功能确切地是什么。
结果我无法构建应用程序,收到了FAILURE消息。