android – WARNING: API 'variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 'variant.getExternalNativeBuildProviders()'-ThrowExceptions

Exception or error:

Unable to resolve this warning. How can I resolve this?

 variant.getExternalNativeBuildTasks()' is obsolete and has been replaced with 
 variant.getExternalNativeBuildProviders()
How to solve:

Just update Fabric gradle plugin to 1.28.0

dependencies {
   classpath 'io.fabric.tools:gradle:1.28.0'
}

###

Add this android.debug.obsoleteApi=true to the gradle.properties file. And make gradle clean, sync and then build an APK. Worked for me. I have Android Studio 3.3 and Gradle version 4.10.1.

For more information check this link out: Android Gradle plugin release notes.

I agree with other contributors: Fabric causes this error.

UPDATE

Check Valdislav Panchenko’s answer:

Now you can just update your Fabric plugin to 1.28.0 as follows:

dependencies {
   classpath 'io.fabric.tools:gradle:1.28.0'
}

###

Most likely it’s caused by Fabric’s plugin needed for Crashlytics.

Commenting out apply plugin: 'io.fabric' resolves the issue. So the only option is to wait until Google devs will fix Fabric’s plugin.

###

It’s caused by one of the Gradle plugins used in your project.
Check build.gradle file and try to remove apply plugin: xxx one by one to understand exactly which plugin is causing the warning.
In our project it was apply plugin: 'io.fabric' after Google update Android Studio to 3.3 yesterday.

###

It happened to me but I needed to continue with the Fabric plugin.

For those who need to keep the Fabric plugin applied, the temporary solution is to go back to the previous version of the gradle at the project level.

Change the classpath version to com.android.tools.build:gradle:3.2.1.

###

For those who are facing this problem eventhough they dont use fabric, forget about Vitaly Zeyenko’s updated answer above and simply go to the gradle folder of your project and open the gradle.properties file and add this line –>>> android.debug.obsoleteApi=true to it…

After that, Clean and rebuild project… This is a better solution than on the command line because a lot of people already have the JDK environment set to wrong locations on their computer and might face more problems solving this issue through the command line

gradle-wrapper.properties in gradle->wrapper

Leave a Reply

Your email address will not be published. Required fields are marked *