如何查找Android 13中所有已弃用的API

huangapple go评论52阅读模式
英文:

How to find all deprecated API for Android 13

问题

在我们的应用中,我们将Android的目标版本从32提高到33。我查看了Google的文档,但没有找到完整的API列表。

例如:mBluetoothAdapter?.enable() 在Android 13上不起作用,但在目标版本32上起作用。

然而,在Google文档中,我没有找到有关API更改的信息,直到我直接访问了这个API页面,那里我可以看到有关API废弃的警告消息。

类似地,我使用了Android Studio的lint工具(代码 -> 分析代码)。我得到的报告也没有提到Android 13的废弃API。

请告诉我如何在我的Android项目中找到所有Android 13的废弃API列表,而不是一般的详尽列表,比如这个:https://developer.android.com/sdk/api_diff/33/changes

英文:

In our app, we are increasing targetversion from 32 to 33 in Android. I checked google documentation. I didn't get complete list of APIs.

for example: mBluetoothAdapter?.enable() is not working for Android 13 however it is working for tragetversion 32.

However, I didn't find anything about API changes in google documentation until I directly go to this API page and there I can see warning message for API deprecation.

Similar, I used lint through Android studio (code -> analyse code). The report I get also does not say anything about deprecated API for Android 13.

Please tell what are the way to find list of all deprecated APIs for Android 13 in my android project instead of general exhaustive list like this https://developer.android.com/sdk/api_diff/33/changes

答案1

得分: 2

你需要从“行为更改:所有应用程序”开始:
https://developer.android.com/about/versions/13/behavior-changes-all

然后是“行为更改:面向 Android 13 或更高版本的应用程序”:
https://developer.android.com/about/versions/13/behavior-changes-13

最后是“Android API 差异报告”:
https://developer.android.com/sdk/api_diff/33/changes

英文:

You need to start with "Behavior changes: all apps":
https://developer.android.com/about/versions/13/behavior-changes-all

Then "Behavior changes: Apps targeting Android 13 or higher":
https://developer.android.com/about/versions/13/behavior-changes-13

And finally "Android API Differences Report":
https://developer.android.com/sdk/api_diff/33/changes

答案2

得分: 0

当我的团队将 targetSdkVersion 从 31 升级到 33 时,我们只是清理了构建文件夹并运行了一次干净的构建(或者您可以只运行 compileDebug Gradle 任务,Android Studio 的“运行”窗口中会列出当前应用中编译器找到的所有已弃用 API 使用情况,以及一些其他随机警告。

对于更具体的已弃用行为,您可以运行 lint 任务来识别这些。

英文:

When my team upgraded our targetSdkVersion from 31 to 33, we simply cleaned the build folder and ran a clean build (or you could just run the compileDebug Gradle task, and the output in the "Run" window in Android Studio will list out all the deprecated API usages that the compiler finds in your current app, as well as some other random warnings.

For more specific deprecated behaviors, you can run the lint task to identify those.

huangapple
  • 本文由 发表于 2023年4月13日 16:31:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/76003315.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定