在此版本中使用了不推荐使用的Gradle功能,使其与Gradle 5.0不兼容 [英] Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0

查看:12606
本文介绍了在此版本中使用了不推荐使用的Gradle功能,使其与Gradle 5.0不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了故障:

..."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-全部 .zip到 4.7-all

    distributionUrl=https....gradle-4.4-all.zip to 4.7-all

    所有这些构建成功之后

    创建了测试成绩

    @TestInstance(TestInstance.Lifecycle.PER_CLASS)
      class TestClass {
    
      @Test
      internal fun testName() {
        Assert.assertEquals(2, 1 + 1)
      }
    }
    

  • 运行了测试,并收到了FAILURE消息.

  • ran the test and got the FAILURE message.

    使用命令行参数./gradlew --warning-mode=all运行Gradle构建,以查看确切不赞成使用的功能.

    ran the Gradle build with a command line argument ./gradlew --warning-mode=all to see what exactly the deprecated features are.

    结果是我无法构建该应用程序,并且收到了FAILURE:消息.

    As a result I couldn't build the app and I've got that FAILURE: message.

    推荐答案

    使用命令行参数--warning-mode=all运行Gradle构建,以查看确切不赞成使用的功能.

    Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features are.

    它将通过Gradle文档的链接为您找到已发现的问题的详细说明,以指示如何修复构建.

    It will give you a detailed description of found issues with links to the Gradle docs for instructions how to fix your build.

    在其中添加--stacktrace,如果警告是由其中一个插件中的过时代码而非您的构建脚本触发的,您还可以查明警告的来源.

    Adding --stacktrace to that, you will also be able to pinpoint where the warning comes from, if it's triggered by outdated code in one of the plugins and not your build script.

    这篇关于在此版本中使用了不推荐使用的Gradle功能,使其与Gradle 5.0不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆