使用android studio遇过查看源码时,弹出以下问题的提示:
Decompiled .class file,bytecode version:51.0(Java 7) Source for 'Android API 23 Platform' not found
download了源码,而且刷新没有用...
于是自己在网上百度一下,发现有以下解决办法:
(使用的是Windows system && version2.0)
step one:
找到配置文件 C:\Users\username\.AndroidStudio(正在使用的版本)\config\options\jdk.table.xml
step two:
打开文件,找到提示版本信息错误的部分.
<jdk version="2">
<name value="Android API 23 Platform" />
<type value="Android SDK" />
<homePath value="D:\as" />
<roots>
<annotationsPath>
<root type="composite">
<root type="simple" url="jar://$APPLICATION_HOME_DIR$/plugins/android/lib/androidAnnotations.jar!/" />
</root>
</annotationsPath>
<classPath>
<root type="composite">
<root type="simple" url="jar://D:/as/platforms/android-23/android.jar!/" />
<root type="simple" url="file://D:/as/platforms/android-23/data/res" />
</root>
</classPath>
<javadocPath>
<root type="composite" />
</javadocPath>
<sourcePath>
<root type="composite">
</sourcePath>
</roots>
<additional jdk="1.7" sdk="android-23" />
</jdk>
step three:
找到sourcePath标签,在里面添加以下子标签.
<root type="simple" url="file://D:/as/sources/android-23" />
</root>
点击保存即可.
But
按照网上百度的步骤,到这里重启android studio就应该可以查看源码了,但刚开始试了两次都没有work.
后来发觉在jdk.table.xml文件下面有一个jdk.table.xml.bak文件(不知道是不是用于还原配置用的).
重复上述步骤,再delete该文件,重启android studio之后就行了.