Android Gradle - Where to add "android.debug.obsoleteApi=true"

The easiest way is do it in the terminal at the root of the android project.

Run the following command:

 ./gradlew -Pandroid.debug.obsoleteApi=true

As stated in the error message, you should add that in gradle.properties file and not in any of your build.gradle files


You need to put it in gradle.properties file which is present at the project level, outside of the app folder not in build.gradle file which you are currently trying to do.

From the android developer documentation

Better debug info when using obsolete API: When the plugin detects that you're using an API that's no longer supported, it can now provide more-detailed information to help you determine where that API is being used. To see the additional info, you need to include the following in your project's gradle.properties file:

android.debug.obsoleteApi=true
You can also enable the flag by passing -Pandroid.debug.obsoleteApi=true from the command line.

You can check this Link.