Adding Android source code and Javadoc in Eclipse

23 July 2012 By Nithya Vasudevan 10,144 views No Comment
8 Flares Twitter 1 Facebook 1 Google+ 6 8 Flares ×

In this Android tutorial, we will see how to add Javadoc in Eclipse IDE which can be very helpful for our development process. If you would like to see even the source code for Android API classes, you can do that too by attaching the Android source code within Eclipse IDE.

As of Android 4

Android source code and Java documentation comes with Android development tools which can be downloaded via the Android SDK Manager by selecting the “Documentation for Android SDK” and “Sources for Android SDK“.

These packages are downloaded to the Android SDK_HOME folder.

PackageLocation
Source code“<SDK_HOME>/sources/android-##”
Javadoc“<SDK_HOME>/docs/reference”

Where, ## is the API level of Android, example, API level is 15 for the Android 4.0.3 version.

Configure Android Javadoc and Source Code in Eclipse

You can use android.jar to attach source code in your Android project.

  • Open your Android Project in Eclipse Package Explorer.
  • Right click on your android.jar and select Properties.
  • Select Java Source Attachment. Enter the source directory location (you can also use External Folder… to browse to the directory) and click on “Apply“.

  • Select Javadoc Location.
  • Click on Browse… and select the directory (SDK_HOME/docs/reference) and click on “Apply” and “OK“.

Test Installation

You can now browse through the source code either by pressing “F3″ or Right click on Android API class name/method/etc in editor-> Open Declaration

Prior to Android 4.0

You can use Eclipse update manager to install the Android Source Code plugin from the following update site URL

http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update

To find more information, you can visit the Google Code Project site

Tags: , , , , , , ,