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

Kotlin Programming

Question or issue of Kotlin Programming:

I’ve got a gradle FAILURE:

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

Case description:


    //(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"

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

How to solve this issue?

Solution no. 1:

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.

Solution no. 2:

Try this one

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

Solution no. 3:

I was getting this error. Turns out it only happened when I completely cleaned the RN caches (quite elaborate process) and then created a release build.

If I cleaned the caches, created a debug build and then a release build, everything worked. Bit worrying but works.

Note: My clean command is…

rm -r android/build ; rm -r android/app/src/release/res ; rm -r android/app/build/intermediates ; watchman watch-del-all ; rm -rf $TMPDIR/react-* ; npm start -- --reset-cache

Solution no. 4:

in my case i updated the build.gradle file and make the classpath to latest version from 3.5.2 to 3.6.3

dependencies {

Solution no. 5:

Update your third party dependencies. for example I updated dependency from
implementation 'com.github.ybq:Android-SpinKit:1.1.0' to implementation 'com.github.ybq:Android-SpinKit:1.2.0'. and in my case issue has been solved.

Solution no. 6:

Set distributionUrl path in gradle-wrapper-properties files as :


Solution no. 7:

Important – Answer work only for REACT-NATIVE VS CODE Terminal

In VisualStudio code, you have to run like below then that warning will be omitted.

react-native run-android warning-mode=all

If you run below then you will get the error in terminal
When running react-native run-android –warning-mode all I get error: unknown option –warning-mode’

Solution no. 8:

The following solution helped me as I was also getting the same warning.
In your project level gradle file, try to change the gradle version in classpath

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

Solution no. 9:

It work for me in this issue in a project of react-native:

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

244 actionable tasks: 2 executed, 242 up-to-date
D8: Cannot fit requested classes in a single dex file (# fields: 67296 > 65536)
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

I Did this:

  • Uninstall the app from my device:

  • The number of method references in a .dex file cannot exceed 64k API 17

Solution no. 10:

In my case adding multiDexEnabled true in Android/build/build.gradle file compiled the files.

I will look into removing this in the future, as in the documentation it says ‘Before configuring your app to enable use of 64K or more method references, you should take steps to reduce the total number of references called by your app code, including methods defined by your app code or included libraries.’

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

Solution no. 11:

Finally decided to downgrade the junit 5 to junit 4 and rebuild the testing environment.

Solution no. 12:

Solution for the issue:
deprecated gradle features were used in this build making it incompatible with gradle 6.0. android studio
This provided solution worked for me.

First change the classpath in dependencies of build.gradle of your project
From: classpath 'com.android.tools.build:gradle:3.3.1'
To: classpath 'com.android.tools.build:gradle:3.6.1'

Then make changes in the gradle-wrapper.properties file this file exists in the Project's gradle>wrapper folder
From: distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
To: distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

Then Sync your gradle.

Solution no. 13:

On a SpringBoot project using IntelliJ and Gradle, I got the warning "Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0" when running my integration test.
What solved the problem was:
- Going to: File > Settings > Build, Execution, Deployment
- Selecting for "Build and run using": Intellij IDEA (instead of "Gradle")
- Same for "Run tests using"
That did not explain why Gradle is displaying the warning, but that let me perform the test and progress in my work.

Solution no. 14:

It was fixed this kind of error after migrate to AndroidX

  • Go to Refactor ---> Migrate to AndroidX

Solution no. 15:

If you're using react-native then please try the below commands first before running your project:

  1. npm install --save-dev jetifier
  2. npx jetify

Now run your project again. Hope this will work.

Hope this helps!