How to attach Android Source to Eclipse
I've previously had success attaching the Android Source to Eclipse by following Finn Johnsen's instructions here.
However this approach seems to have stopped working:
samuel-josephs-computer-4:android-sources samueljoseph$ git checkout origin/froyo-release
Previous HEAD position was 1de4a2c... am 62619392: Merge "Fix leak when keylock is recreated."
HEAD is now at adba66b... This class no longer exists.
There was a more recent blog here which had some pre-organized source for Eclair, but nothing since.
There are also some StackOverflow posts from 2008 (older than both the above), e.g. https://stackoverflow.com/questions/3182904/attaching-java-source-to-android-projects-in-eclipse.
What is the current guidance for accomplishing this?
Solution 1:
There is a updated guide. So, you don't need to install an eclipse plugin for this.
Here is the link
Snip from above Link:
follow below steps if you already have downloaded Android sources
Head into eclipse, and press F3 over some android source you're missing, like Activity. And get this pesky window, which we all hate:
Click Attach Source, choose External Folder, and choose the core/java in the base folder.
Solution 2:
There is an Eclipse plugin called Android Sources that installs the sources up through Gingerbread. I haven't tried it recently.
Solution 3:
For Android 4+ here's a tutorial for attaching sources to eclipse.
EDIT:
- First download the source and javadoc from sdk manager.
Goto Your_Project>>Android XXX, Right-Click on
android.jar
and selectProperties
.Point the sources path as Java Source Attachment>>Location Path by clicking on External Folder
Point the reference path as Javadoc Location>>Javadoc Location Path by clicking on Browse
Now you can browse sources like this:
Solution 4:
Here's a tutorial:
-
Make sure you have installed/downloaded the Android source for the appropriate Android SDK API version.
1.1 Check the API version you have specified in Eclipse for Android/Project Build target:
-
Open project Properties/Java Build Path and click the "Link Source..." button on the Source tab:
-
Point to where you have installed the Android SDK, expand the "sources" folder, select the appropriate source API version (and click "OK"):
-
Next...:
-
Important step is to exclude the whole linked source from building. Otherwise we could have some duplicate source errors plus who wants to build the whole Android source when we have jars already! So, click "Add...", type in
*
, click "OK" (and then "Finish"): -
Verify everything is configured correctly:
Desired result -- linked platform source w/o side effects:
I hope this helped :)