下载 Android SDK 32 源码时出现 "All packages are not available for download" error

739 阅读1分钟

最近项目升级到了 Android SDK 32,今天在查看 android 中的 Log 类源码时,发现每个方法显示的都是:

throw new RuntimeException("Stub!");

同时上方提示 Sources for 'Android API 32 Platform' not found, 还有一个 Download 按钮:

Sources for 'Android API 32 Platform' not found

点击 Download 后弹出提示 All packages are not available for download:

All packages are not available for download

在网上搜索一番,发现 Stackoverflow 上已有讨论:All packages are not available for download error in android

打开 SDK Manager,查看已经下载的 SDK 信息:

SDK Manager

勾选 Show Package Details,可以看到 Android SDK 31 中,提供了 Sources for Android 31 下载,但 Android SDK 32 中却没有提供 Sources for Android 32。

是不是 Android SDK 32 的源码暂时没有发布呢?再在网上搜索一番,发现 Stackoverflow 上也已有讨论,证实了这个猜想:Android API 32 Sources not Found

也就是说 Android SDK 32 的源码还没有发布出来。所以暂时的解决方法就是把 app/build.gradle 中的 compileSdkVersiontargetSdkVersion 降至 31,查看 Android SDK 31 的源码。想要查看 Android SDK 32 的源码估计还要等一段时间。