This has been done before, but the way I set it up now is easier than other methods I’ve seen.
- Visit the Git site for browsing the Android framework source.
- Click the “tree” link next to the branch you want (e.g. Eclair, Donut, Cupcake, etc.)
- Click the “snapshot” link to download a tgz of the source for that branch.
- Create a
sourcesdirectory in the associated platform directory of your Android SDK. For Eclair, it should be something like~/android-sdk-linux_86/platforms/android-7/sources(depending on where you installed your SDK). - Extract the tgz to the new
sourcesdirectory you created. - Restart Eclipse and voila, you have browseable Android source code for your chosen platform.
You’ll need to repeat these steps for each platform you use as a target for your projects. As a bonus for making it to the end of this post, here’s a summary of platform numbers, version numbers, and code names:
- Cupcake (version 1.5) is
platform/android-3 - Donut (version 1.6) is
platform/android-4 - Eclair (version 2.0, 2.0.1, 2.1) is
platform/android-{5,6,7}