解决方法
Step1.下载源码
通过 SDK Manager 可以查看和下载源码包。
Android Studio 会根据 compileSdkVersion 的值去加载对应版本的源码包。所以,源码包选择下载的版本和编译版本 保持一致。
image
Step2.关联源码
找到 jdk.table.xml,找到源码相应版本的 < sourcePath>标签,把源码路径写进去就可以了。
image
-
源码路径:
~/your-sdk-path/sources/ -
jdk.table.xml 地址:
-
Mac:
~/Library/Preferences/AndroidStudio{version}/options/jdk.table.xml -
Windows:
C:/Users/AndroidStudio{version}/config/options/jdk.table.xml其中 AndroidStudio {version} 要换成具体版本。
例如我的是: ~/Library/Preferences/AndroidStudio3.0/options/jdk.table.xml
-
Step3.重启 Android Studio
最后的一步,交给万能的重启。哈哈,重启是为了让 Android Studio 重新加载配置。
转载地址:https://www.jianshu.com/p/4b105e25b057