Android Source Code released, a lego minifigure comic strip made with Comic Strip It!

I'm quite surprised it took this long, but as of 13th December 2011 the source-code for Android is finally available as part of the SDK downloads, and can be grabbed with the SDK Manager.

There's no jar file available yet, just a folder containing the source for API level 14 and upwards only. The Android dev who announced this stated that it is "extremely unlikely" that the source for earlier API levels would ever be made available as part of the SDK.

Android Developer Tools (Eclipse plugin) doesn't automatically link to this folder either, so you need to set it up manually.

First, get the source:

  1. Fire up the SDK Manager - from Eclipse's "Window" menu, select "Android SDK Manager".
  2. Check the boxes next to "Sources for Android SDK" (at time of writing this is available for both API level 14 and 15).
  3. Click the "Install X packages..." button (bottom right corner), and wait while your new goodies download and install.

Once you're done downloading, head back to Eclipse and configure your Android project to use the source directory:

  1. In the package-explorer, locate the Android jar file (you may have to turn on "Show referenced libraries" from the little down-arrow icon in the top-right corner of the Package Explorer toolbar before it will show up in the list).
  2. Right-click the jar and choose "Properties" - a dialog pops up.
  3. Select "Java Source Attachment", then click "External Folder..."
  4. Navigate to the source directory, which will be located inside your Android SDK install directory (mine is at /home/steve/dev/sdks/android-sdk-linux/sources/android-14. Select OK to leave the file-chooser dialog, and OK again to leave the jar Properties dialog.
  5. Hover any Android class and ctrl-click (or place the caret on the class name and hit F3) to enjoy the source code for that class :)

For the full source-code saga check out the issue-tracker entry requesting the source to be made available (be prepared for a long read!)

blog comments powered by Disqus