当前位置: 移动技术网 > 移动技术>移动开发>Android > Android Studio查看源码时出现Sources for ‘Android API 30 Platform’ not found 的 解决方法

Android Studio查看源码时出现Sources for ‘Android API 30 Platform’ not found 的 解决方法

2020年07月23日  | 移动技术网移动技术  | 我要评论

Android Studio 默认的 compileSdkVersion 是30,但是 SDK Platforms 中并未提供 API 30 源码下载,所以报如上错误。

Android Studio --> Preferences & Behavior --> System Settings --> Android SDK --> SDK Platforms: 

我们可以看到 Android API 30 是没有源码提供下载的(我自己实践成功后才出现了图中划掉的源码),但是我们可以下载Android 29的源码。

解决方法:强行拷贝API 29 当做 API 30使用。

1. 到Android SDK 目录(/Users/tian/Library/Android/sdk/sources )下复制 android-29 并修改为 android-30;

2. 修改 android-30 中的 package 和source.properties文件,将其中的所有 29 改为30;

3. 修改jdk.table.xml 文件,把所有Android API 30 Platform 的<sourcePath> 标签中的路径改为 android-30 的路径

该文件Mac路径: /Users/tian/Library/Preferences/AndroidStudio3.5/options/jdk.table.xml

Windows路径:C:/Users/AndroidStudio{version}/config/options/jdk.table.xml

4. 重启Android Studio,便会有源码提示了(本人亲测有效)。

本文参考:

androidstudio查看源码时出现Sources for 'Android API 26 Platform' not found解决方法

AndroidStudio-Sources for 'Android API Platform' not found

本文地址:https://blog.csdn.net/tianyaluqingchen/article/details/107509520

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网