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

Philipp Buhaievskiy picture Philipp Buhaievskiy · Jul 31, 2018 · Viewed 198.8k times · Source

I've got a gradle FAILURE:

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

Case description:

  • Attached to the project codebase the next libs:

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"
  • Updated the gradle-wrapper.properties

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

  • after all of that gradle was built success

  • created the test calss

    @TestInstance(TestInstance.Lifecycle.PER_CLASS)
      class TestClass {
    
      @Test
      internal fun testName() {
        Assert.assertEquals(2, 1 + 1)
      }
    }
    
  • ran the test and got the FAILURE message. enter image description here

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

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

Answer

hotkey picture hotkey · Jul 31, 2018

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

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

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.