28

While trying to debug a program I wrote in Eclipse for Android, I receive an error saying there's no source attachment for android.jar.

How do I get that source attached to Eclipse to continue my debugging?

1

3 Answers 3

54

In Eclipse:

Window > Android SDK Manager, install "Sources for Android SDK" under Android 4.0

When prompted by "No sources attached...", click the button, then choose the Directory "your Android SDK directory/sources/android-API level/"

Example: C:\...\android-sdk-windows\sources\android-16

Sign up to request clarification or add additional context in comments.

4 Comments

That did not appear to help, still with the same error. Any other suggessions?
Ok, I saw the edit, that was the exact directory I chose. Anyways, should I choose /sources/android-14, since its android 4.0? Because I also installed sources for android-15 (version 4.0.3). Maybe the computer got stuck while there's a duplicate of sources under /sources? I also didn't get why we do this. Why attach sources, what's the point of doing so? What does the attachment include?
yes i think you have to choose /sources/android-14, the point of doing so is if you want to open declaration of an android method, you can see the source code of android behind it (in Eclipse Ctrl+ click on a method)
It works for me. I'm using ADT, Android Developer Tools, and after downloading the sources I added this path adt-bundle-linux-x86/sdk/sourcs/android-17
1

If you really want to have the android.jar sources, follow these easy steps: (for Eclipse IDE)

  1. Install plugin Android Source by going to Help->Install New Software-> add this site: "http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/". Select Android Sources from the list, click Next, and install like usual. Restart Eclipse when prompted.

  2. If sources are still not attached, attach them manually. You will find the sources in the plugin folder usually ECLIPSE_PATH\plugins\com.android.ide.eclipse.source_MAY_BE_VARY\VERSION Depending of the version of Android, they'll be in the different folders. (eg: for Android 4.4 the sources are in folder named 14). Sources will be in source.zip archive.

Comments

0

In Eclipse package explorer:

Right click on android.jar then Maven->Donwload Sources.

Wait a bit until the process is finished and you're done. (I am not sure if checking "Install Sources" in Android SDK Manager is a prerequisite for this, but you can try and tell us)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.