to attach source code for android.jar, you may follow the tutorial at the link below: http://android.opensourceror.org/2010/01/18/android-source/ make sure to choose the correct platform version.
if you meet difficutly with spinner, try to get the sample code and see how it works: http://developer.android.com/resources/samples/get.html
good luck. :)
this answer is quite out of date, please consider other answers.
i added appengine sdk and some other sources, and that destroyed my adt :-(
i saw that for android-16 and android-17, the platform libraries downloaded by sdk manager started going to ./sdk/sources whereas prior to my adding appenginge sdk, sdk manager sent platforms to ./sdk/platforms.
it looks like the change is as a result of the appengine sdk, but for adt, platform apis should def be going to ./sdk/platforms
the path ./sdk/sources seems like a more generic java location and is probably the 'correct' path. thus android, as usual, is the problem. i was pretty sure from this point forward, i would need both ./sdk/sources and ./sdk/platforms, depending on what i was compiling.
so, i moved everything from ./sdk/sources to ./sdk/platform, deleted ./sdk/sources and then created a link 'cd sdk && ln -s platform sources'
everything works now ;-)
for me the only solution which worked was the answer of fsbmain. kudos to him. i can't comment on his solution because of my low reputation counter. but i want to share my knowledge ;)
i'm working on windows and don't wanted to copy the whole source tree to another location. and copy again on updates etc. so i used the possibility to insert a symbolic link which works since windows vista like a charm (or like linux). for linux you have to look at the joe's comment under fsbmain's answer.
assuming you have the platform in d:\sdk\platforms\android-19. now you have to make a subdirectory sources and after that create a relative link to the real sources folder.
d:\sdk\platforms\android-19\sources>mklink /d android-19 ..\..\..\sources\android-19
now restart eclipse ... done!
what worked for me follows the answer found in murach's android programming. i got stuck trying to debug and tried to work it out for about 3 hours before turning to the next page (literally) where it said "sometimes eclipse will display a source not found message because...." (-headdesk-)
my solution was to turn on step filtering and add the packages that i wanted to skip when debugging. evidently, eclipse sometimes steps through all the source code libraries, when all you want is for it to step through your code. you can bypass this by adding the packages you want to skip to the filter. according to murach, you kinda just do it by trial and error, starting with selecting all packages and adding them. as you continue with debugging you might find you need to add more packages to the filter.
specific steps: 1. turn on step filtering; click the button in the toolbar on the top that looks like this: http://i57.tinypic.com/x3iccp.png 2. go to window-->preferences, then in the preferences dialog, select java-->debug-->step filtering 3. select all packages. 4. to add additional filters, click "add filter", type the name of the package with a .* at the end, and click ok. murach recommends adding these common packages to begin: --android.* --com.android.* --com.google.* --dalvik.* --libcore.* --org.apache.* so to add one of these packages, click "add filter", type "android.*", and click ok. i ended up having all of the following packages on my step filter preferences.
android., android.app., com.android., com.google., com.ibm., com.sun., dalvik., java., javax., jrockit., libcore., org.apache., org.omg., sun., sunw.*, ((and this last one is a class, not a package)) java.lang.classloader
i had "use step filters" checked at the top of the dialog box, and "step through filters" checked at the bottom. click "apply", then "ok" to close the dialog. it should work.
if adding folder
android-sdks/sources/android-17 as external source doesn't work (as in my case) you can try to create folder
android-sdks/platforms/android-17/sources/android-17 copy sources to it and restart eclipse (i have eclipse juno service release 1). only this way works for me.
steps to do this for android-17:
- go to the
adroid-sdkinstall folder, for me it's
android-17sources folder from
android-sdks\platforms\android-17\sources\(your have to create folder
sourceshere manually) folder so the final path to the sources must be the:
- restart the eclipse, it must automatically attach sources for android-17
upd: the same solution with
windows vista+ (thanks @saleemrashid1 for mentioning
mklink in comments):
1. cd platforms\android-17
2. mklink /d "sources\android-17" "..\..\..\sources\android-17"
for unix-base oses (@joe comment):
it works fine to create the directory and symlink "sources/android-xx" to "../../../sources/android-xx":
mkdir platforms/android-19/sources &&
ln -s ../../../sources/android-19 platforms/android-19/sources/android-19.
unless you need older api sources, you are probably better served by timmmm's answer. if you do need sources older than 14, read on...
in eclipse simply go to
help -> install new software
then add update site
and go through the motions to install it.
this will happily provide sources for all installed api versions and works very well for me. some more documentation is here
look for the heading android sources
this is now really easy!
go to window->android sdk manager and install "sources for android sdk".
now try to control-click some android identify, you will get the usual "no source attached" page. click "attach source" and get the option to select an external folder.
now browse to
/home/me/android-sdks/sources/android-16 (or wherever your sdk is installed; this is the default), and hit ok.
it should think for a moment and then display the source! yeay!
- How to attach source or JavaDoc in eclipse for any jar file e.g. JavaFX?
- How do I attach the Android Support Library source in Eclipse?
- How to attach Android Source to Eclipse
- How to attach Android source to Eclipse?
- How to attach the source to the jar in the Gradle Eclipse Project when the source attachment is not modifiable?
- How to modify source android when I attach the source
- How to attach jar file to source file in Eclipse in a general case?
- Android JAR attach source error
- Android JAR attach source error
- How to attach source to android.jar
- Attach the Source in Eclipse of a jar
- How to attach back the Android emulator to ADB?
- How to attach source code of libraries downloaded with ivy
- How to tell Maven to include the jar dependency, not the subproject source directory in Eclipse?
- Eclipse : How to remove the attached Source which was added to a Jar
- Using ADT and SDK manager, attach android source code to eclipse
- How to attach source to Google Drive API or `Android Private Library` in Eclipse
- How can I link source to a jar package in eclipse?
- Attaching source to an external jar in an android eclipse project
- How do I attach source code locations to plugins in my Eclipse RCP target platform?
- How to attach javadoc for jar in eclipse?
- Can the Gradle Eclipse Plugin attach source jar files to local jar dependencies
- How to use and package a JAR file with my Android app?
- How to attach source to the libraries on Eclipse CDT
- How to use the same source from PhoneGap Build and PhoneGap Android project in Eclipse
- How do I see source or javadocs for a library dependency in an Android package in Eclipse?
- how to import source code into Eclipse from a jar file?
- The JAR file C:\sdk\platforms\android-18\android.jar has no source attachment. You can attach the source by clicking attach source below
- How can I browse the source code in a jar file containing source code in Eclipse?
- Eclipse: How can I attach JavaDoc to multiple JAR files?
More Query from same tag
- Unable to debug Eclipse Application because of missing classes
- how to find which method called a specific method with break point in it
- Configuring Glassfish to use Equinox
- ClassNotFound Exception: org.postgresql.Driver from [Module "deployment.ValidateUser.war:main" from Service Module Loader]
- Eclipse Building workspace fails after importing AndroidAnnotations
- Access restrictions in Eclipse Multiple Projects with Gradle
- Can't use Scanner class, constructor is undefined, method is undefined
- error when installing ObjectAid on eclipse
- Ordering list of image file names as numbers not as strings (on Android)
- Xtext - Content proposal match context indentation
- Why is Eclipse asking to declare strictfp inside enum
- Setting up ActiveJDBC for an Eclipse project that does not use Maven
- Change location of .project and .cproject files in Eclipse CDT
- How should I be storing these values?
- Auto import new Java classes added to project path on startup in Eclipse
- Maven POM-Editor: Dependency Graph missing
- How to undo an Eclipse workspace
- Initializing PHP Tooling blocked at 12%
- Eclipse Indexer with IAR plugin
- Linkedin API. How do I get a pop window which asks user to click on allow and automatically get the code instead of copying and pasting in Linkedin
- Maven build failed because of Lambok annotated classes
- Advantages Jetbrains MPS has over Xtext
- Synchronize an Eclipse project with Google Drive
- polygot persistence gremlin queries help needed
- How to avoid to Time out Exception?
- Tools for debugging hibernate config
- How to preview the layout for ~ 21 inch device in android eclipse sdk?
- Maven compilation jibx plugin
- Integration (maven) of Spring Data Neo4j in Dynamic Web Project using Jersey and Tomcat