04 March 2014

Android Development: Browsing Android Source in Eclipse

The Problem

I got bored of seeing messages like:
"the jar of this class file belongs to container android private libraries..."

The Solution

You need to tell Eclipse how to resolve the source files so it knows where to find them.
  • It requires ADT in version 20 or later.
  • You must first download the sources using the SDK Manager
  1. In the libs directory of your project you will find the android-support-v4.jar library. In that directory create a text file with the same name as the JAR, but with a .properties suffix  i.e.
  2. Open the created properties file and set the value of a property named src to the location where sources for that library can be found e.g.
    Where: [username] is the username of your account
  3. Save the file.
  4. Close and re-open your android project.
  5. Try browsing to one of the definitions of a standard Android method (i.e. in the support classes).

No comments:

Post a Comment