This is a quick note to pass along a tip about viewing Android source code while you are working in Eclipse. If you’ve ever been frustrated with not knowing how the Android team did something in their code, you will really appreciate the Eclipse add-on for “Android Sources”. You can find it at http://code.google.com/p/adt-addons/. The installation instructions are about a screen or two down the page. The title of the section is “Android Sources”.
Having access to the source jar really makes debugging easier. As you check the stack to see how your methods were called, you will see source code for the Android classes.
Just follow the instructions on the adt-addons page to install. When that finishes, it’s not really obvious that anything has happened. So you might want to check the installed software window in Eclipse. It should look like this:
Another thing you can check is that the source code has been attached to the Android jar file. Go to one of your Android projects in Eclipse and find the Android jar. Expand that and pick a class within one of the packages. When you click the class, you should see the source code for the Android class. For my project, which uses Android 2.2, it looks like the following:
Thanks go to the ADT-addon people for their work. And thank you, members of the TriDroid meetup group, for sharing the tip.





Installed the plugin. Now what?
Two things to try:
(1) The next time you are debugging and move back in the stack to the point that called your code, check the view in the debugger. The Android source code is there. So if there is something not particularly clear about what an Android method does, you can browse around right there in your debugging session.
(2) You can go directly to the Android source code in the Eclipse Package Explorer and Project Explorer. I updated this blog post (above) and added a screenshot that shows that.
Thanks!
Thank you!