Android Studio 檢視不到SDK原始碼解決辦法
阿新 • • 發佈:2019-02-01
在使用 Android Studio 開發時,我們需要檢視SDK的原始碼,但是有時候看到的原始碼是類似這樣的提示,
- Sources for Android API 24 Platfrom not found
如果我們沒有下載SDK的原始碼,點選Download提示,便會下載某個版本的SDK原始碼。下載完成,重啟 Android Studio後,檢視SDK某個類的原始碼,還是提示,
- Sources for Android API 24 Platfrom not found
需要我們修改jdk.table.xml檔案來配置原始碼路徑,
1.找到jdk.table.xml
,
windows平臺下,該檔案路徑是 “C:\Users\Administrator\.AndroidStudio2.1\config\options”,其中AndroidStudio2.1為你的AndroidStudio的版本。
2.新增相應的程式碼,
使用文字編輯開啟jdk.table.xml,在相應的SDK版本的尾部新增SDK原始碼的路徑,例如,
新增如下程式碼,
- <sourcePath>
-
<roottype="composite"
- <roottype="simple"url="file://D:/Users/Administrator/AppData/Local/Android/sdk/sources/android-24"/>
- </root>
- </sourcePath>
一定要記得標籤的格式。
3.重啟Android Studio即可。