最近更新了AndroidStudio,升到了2.1,但是也同时出现了一些问题,比如查看Android源码的时候出现如下提示:
网上查了下也有相应的解决方案,写一下方便以后查看。
进入到/home/.AndroidStudio2.1/config/options/
目录下,找到jdk.table.xml
文件,用编辑器打开后,找到相应的平台:
<jdk version="2">
<name value="Android API 23 Platform" />
<type value="Android SDK" />
<homePath value="$USER_HOME$/Apps/Developer/android/sdk" />
<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://$USER_HOME$/Apps/Developer/android/sdk/platforms/android-23/android.jar!/" />
<root type="simple" url="file://$USER_HOME$/Apps/Developer/android/sdk/platforms/android-23/data/res" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root type="simple" url="file://$USER_HOME$/Apps/Developer/android/sdk/docs/reference" />
</root>
</javadocPath>
<sourcePath>
<root type="composite" />
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-23" />
</jdk>
可以看到<sourcePath>
节点中的<root type="composite" />
并没有源码的路径,这是android-23
, 如果查看android-22
的话,可以看到如下的代码:
<sourcePath>
<root type="composite">
<root type="simple" url="file://$USER_HOME$/Apps/Developer/android/sdk/sources/android-22" />
</root>
</sourcePath>
将url
中的路径放到android-23
中的同样位置,并将结尾的android-22
改为android-23
,重新打开AndroidStudio后,就可以查看Android源码了。
<jdk version="2">
<name value="Android API 23 Platform" />
<type value="Android SDK" />
<homePath value="$USER_HOME$/Apps/Developer/android/sdk" />
<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://$USER_HOME$/Apps/Developer/android/sdk/platforms/android-23/android.jar!/" />
<root type="simple" url="file://$USER_HOME$/Apps/Developer/android/sdk/platforms/android-23/data/res" />
</root>
</classPath>
<javadocPath>
<root type="composite">
<root type="simple" url="file://$USER_HOME$/Apps/Developer/android/sdk/docs/reference" />
</root>
</javadocPath>
<sourcePath>
<root type="composite">
<root type="simple" url="file://$USER_HOME$/Apps/Developer/android/sdk/sources/android-23" />
</root>
</sourcePath>
</roots>
<additional jdk="1.8" sdk="android-23" />
</jdk>