Adding Android source code and Javadoc in Eclipse

23 July 2012 By Nithya Vasudevan 18,141 views 2 Comments
0 Flares Twitter 0 Facebook 0 Google+ 0 0 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.

Source code“<SDK_HOME>/sources/android-##”

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

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

Tags: , , , , , , ,