Fixing slow code assist for Android in Eclipse Helios – update 2 (and getting Android sources into Eclipse, too!)
As you can see from my previous posts, getting code assist to work well for Android projects in Eclipse Helios can be done in one of two ways. You can either uninstall Android JavaDoc package and lose method and parameter descriptions in code assist, or install a patched eclipse JDT plugin.
There is a third way, and you get Android sources for easy referencing and debugging too. Best thing, it’s really simple and only takes three steps.
Update January 29, 2011: make sure to also check out this post, which shows how to build with one version of Android and debug with sources for another.
1 – Get Android framework sources
If you don’t build Andorid system images, and don’t have Git and repo tool, get the sources from http://android.git.kernel.org as a tarball.
This is the framework tarball for Froyo (108 Megabytes):
You can get other versions by changing the tag (froyo) in the link above (to donut, gingerbread, etc.)
2 – Extract a portion of the tarball into the right place
Eclipse wants sources in the right place, organized by package name, the same way the source code for your project is organized.
That right place is a “
sources” directory that you should create under your
Open the tarball with your favorite program (I use WinRar) and navigate to core\java inside it. You will see a directory called “android”, which looks like this:
Now you need to extract the “
android” folder inside the tarball into
android-sdk-windows\platforms\android-VERSION\sources, so you get this:
3 – Verify the settings for Android.jar and hit refresh
Right click on android.jar in your project, and verify the location path:
After closing this dialog, refresh your project (press F5 in the project explorer or right-click on your project and choose Refresh).
And this is what we get from doing the above
JavaDoc in code assist
The ability to view Android framework sources right from Eclipse
… which also works in the debugger
And that’s it. With many thanks to http://android.opensourceror.org/2010/01/18/android-source/