Using ADT and SDK manager, attach android source code to eclipse

点点圈 提交于 2020-01-01 08:38:15

问题


After installing ADT, I used SDK Manager to download the source codes for the latest android API. Now when I run the Eclipse version that was provided with the ADT, I still can't see the android source codes.

Is there a simple way to fix this?


回答1:


Open SDK Manager-->install source under api(i.e Android 4.0)

if You got No sources attached then click the button, then choose the Directory

e.g: D:\Android\android___sdk\sources\android-17\ ---> this my android sdk location

Depend upon your android installation directory choose accordingly.




回答2:


After downloading the Sourcecode by useing the "Android SDK Manager", you have to change the settings in your eclipse-porject.

At first, just have a look where the Sourcecode has been downloaded. In my case (useing Windows 8) its here: "C:\adt-bundle-windows-x86_64-20130219\sdk\sources\android-17"

  • Now go into Eclipse.
  • Open the "Properties" of the project (right click on the project-folder and click on "Properties").
  • On the left side click on "Java Build Path" and then click on the tab-page "Libraries".
  • Next you click on the right side on the button "Add External Class Folder...".
  • Select the folder where you find the sourcecode. In my case its the folder "android-17" of the path "C:\adt-bundle-windows-x86_64-20130219\sdk\sources\android-17".
  • Commit / close all windows with ok. (Maybe you should restart eclipse.)

And now you can see/read the Android-Sourcecode. (But only in the project which you have choosen before.)




回答3:


First, you need to download them. Use Android SDK Manager -> Android X.Y.Z (API A) -> Sources for Android SDK.

Then, you need to attach the folder with the sources the next time you browse there: /sources/android-A




回答4:


Previous answers are great but here you have a complete resource by Lars Vogel who address this question. I hope it may be useful as well as it was for me.




回答5:


I found this for me:

For main lib: android.jar: src: sdk/sources/android-19 doc: sdk/docs/reference/

For support lib: android-support-v4.jar: (before this we should add android-support-v4.jar like external jar (Project Properties -> Java Build Path -> Libraries, then in Tab ‘Order and Export’ pull up this library before Android Private Libraries)) src: sdk/extras/android/support/v4/src/java doc: http://developer.android.com/reference/android/support/v4/app/package-summary.html (not sure)



来源:https://stackoverflow.com/questions/16432818/using-adt-and-sdk-manager-attach-android-source-code-to-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!