WARNING: API 'variant.getMappingFile()' is obsolete and has been replaced with 'variant.getMappingFileProvider()'

Viewed 12334

I just updated Android Studio 3.5 to Android Studio 3.6 and replaced previous Gradle plugin with Gradle plugin 3.6.0 when syncing Gradle:

build.gradle: API 'variant.getMappingFile()' is obsolete and has been replaced with 'variant.getMappingFileProvider()'

Any suggestions on how to debug this warning. Where is it coming from? I don't see any usage of getMappingFile in my code although, might be some library. Suggestions to debug these kind of cases would be helpful

5 Answers

Upgrading

classpath 'io.fabric.tools:gradle:1.29.0'

to

classpath 'io.fabric.tools:gradle:1.31.2'

in my top-level build.gradle fixed the problem for me.

When running the gradle script with the parameter -Pandroid.debug.obsoleteApi=true set, you can get a stack trace of what is causing the issue.

I found out it in my case was related to Crashlytics. There was this issue opened, but it's apparently the legacy-plugin so the issue has been closed again with a suggestion of contacting the Fabric support. So hopefully they will find a solution.

  1. Go to build.gradle under Gradle Scripts
  2. Add this Line: classpath 'io.fabric.tools:gradle:1.31.2'
  3. Rebuild your Project.

If your project uses Firebase: instead of upgrading io.fabric.tools:gradle version it's better to switch to com.google.firebase:firebase-crashlytics-gradle since fabric is deprecated now. See Upgrade to the Firebase Crashlytics SDK guide for detailed instructions.

Maybe it could be of help to someone. In my case, it was:

variant.mappingFile 

which was used in build.gradle to backup mapping files. To remove the warning use:

variant.mappingFileProvider
Related