26 December 2009

Developing Android apps -> the android.jar source

edit: this method is outdated. This one works now (16 April 2011).


An android project in eclipse don't provide JavaDoc nor sources to android.jar out of the box. Which is quite annoying once you start doing some real development, especially for a first timer who don't know the API too well (like yours truly).

Here is how I fixed it, by checking out the source.
#cd ~/src/
#git clone git://android.git.kernel.org/platform/frameworks/base.git android-sources
#cd android-sources
#git branch -r
origin/HEAD -> origin/master
origin/cdma-import
origin/cupcake
origin/cupcake-release
origin/donut
origin/donut-plus-aosp
origin/donut-release
origin/eclair
origin/master
origin/release-1.0

I'm using 1.5 aka Cupcake, so I'll checkout that
#git checkout origin/cupcake-release

assuming you've got the sdk in /opt/ like me
#cd/opt/android-sdk-linux_86/platforms/android-1.5
#ln -s ~/src/android-sources sources

That's it, restart Eclipse and you should get the source (with javadoc) when stepping into android classes.

Still not getting the source? See the follow up made after having another fight on this.

/Finn