且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android Gradle - 在哪里添加“android.debug.obsoleteApi=true"

更新时间:2023-12-06 14:48:58

您需要将其放在 gradle.properties 文件中,该文件位于项目级别,位于应用程序文件夹之外 在您当前尝试执行的 build.gradle 文件中.

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.

来自安卓开发者文档

使用过时 API 时的更好调试信息:当插件检测到您使用的 API 不再受支持时,它现在可以提供更详细的信息来帮助您确定该 API 的使用位置.要查看其他信息,您需要在项目的 gradle.properties 文件中包含以下内容:

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
您还可以通过从命令行传递 -Pandroid.debug.obsoleteApi=true 来启用该标志.

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

您可以查看此链接.