Monday 12 November 2012

How to attach Android source to Eclipse

Don't you hate it when you hit F3 on an Android class and you get Eclipse's ugly class viewer instead of Android's actual source for that class?



There's an easy way to fix it.


In Package Explorer expand your Android library entry (in the case above it's Android 4.1) and right click the android.jar file.

Select Properties...

Fill out the information like I've done here.


In summary, select Java Source Attachment in the left pane.
Mark the External location radio button.
Enter the path of the Android source you've downloaded through the Android SDK Manager.

If you don't have the contents of <android_sdk_location>/sources/<android_version> then you'll need to open your Android SDK Manager and download the source for the appropriate version.

Now next time you want to Open Declaration for an Android class, it'll be in a format that's not going to burn out your eyes. :]

No comments:

Post a Comment