問題描述
Source not found
The JAR file D:\.....\sdk\platforms\android-17\android.jar has no source attachment.
提示就是找不到android.jar對應的source code
解決辦法:
由于我的工程創建時選擇的Target SDK 和 Compile with選項 均為android4.2.2,對應的api是17,因此就是eclipse找不到android api 17中的android.jar的源代碼。
1. 使用SDK Manager下載4.2.2版本的Sources for Android SDK
以本機為例下載后的目錄為:
D:\adt-bundle-windows-x86_64-20130522\sdk\sources\android-17
2. 添加源代碼
點擊出錯窗口中的Attach Source...按鈕,然后
找到
D:/adt-bundle-windows-x86_64-20130522/sdk/sources/android-17
點擊OK后源代碼就顯示出來了
================
2013.10.9更新:
可能是使用了android4.3(API 18)新的api,今天使用Eclipse/ADT Bundle出現了
the source attachment does not contain the source for the file *.class 的問題,而指定的源代碼目錄是沒有問題的,問題竟然是編碼問題。
上圖中的Encoding選項修改為UTF-8,問題解決。
以上就是本文的全部內容,希望對大家的學習有所幫助。