Viewing Android Source Code in Eclipse

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 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.

Viewing Source In DebuggerViewing source of class

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:

Installed Software window

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:

Screenshot of Android source in Eclipse

Thanks go to the ADT-addon people for their work. And thank you, members of the TriDroid meetup group, for sharing the tip.

About Bill Lahti

Bill Lahti is a software engineer building mobile applications and knowledge management solutions. Two of his interests are writing for this blog and building Android apps, with strategy games being an area of particular interest.
This entry was posted in Android and tagged , , . Bookmark the permalink.

4 Responses to Viewing Android Source Code in Eclipse

  1. figus salvatore says:

    Installed the plugin. Now what?

    • blahti says:

      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.

  2. figus salvatore says:


  3. ololosh says:

    Thank you!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s