Android Source Code available!
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:
- Fire up the SDK Manager - from Eclipse's "Window" menu, select "Android SDK Manager".
- Check the boxes next to "Sources for Android SDK" (at time of writing this is available for both API level 14 and 15).
- 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:
- 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).
- Right-click the jar and choose "Properties" - a dialog pops up.
- Select "Java Source Attachment", then click "External Folder..."
- 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.
- 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