Reputation: 63
I'm new to Android and I'm attempting to debug an Android app issue (using Eclipse with Android SDK).
I'd like to step into the Android platform code (specifically code in Activity.class
, more specifically code in the startActivityForResult()
method where the problem is occurring) and I can't seem to properly get Eclipse to find the code for Activity.class
so I can step in and see that source. It gives me the ‘Source not Found’ and I've tried attaching android.jar
from several places with the ‘Change Attached Source’ button or via the Project Properties but none of these seem to work. (android.jar taken from the adt-bundle/sdk/platforms/android-7
folder as well as a version taken from the prebuilts/sdk/7
folder of the repo.)
I'm building/debugging with the Google APIs 7 (Android 2.1). The project is set to target Google APIs 7 and the Android virtual device is set to that target as well.
I've tried pointing the source attachment to a local directory that contains Activity.java
downloaded from the latest repo (frameworks/base/core/java/android
).
Do I need to try to get the version of that source directory used for Android 2.1 from the repo? Or is the fact that I'm building with Google APIs 7 (rather than Android open source 2.1) the problem? Or is there some other android.jar
I should be pointing to?
Upvotes: 6
Views: 3514
Reputation: 370
There is another simple way (though this cant be used for API v7)
This method can be used for all APIs that provide Sources.
Download Sources for android SDK for the API.
Goto the sources folder in android SDK and copy the downloaded source . Eg : If you have downloaded source for API 15 , in your sdk there will be folder named sources and in that folder all the downloaded sources will be listed. So copy the corresponding source folder (will be named as android-15 in this case).
Now goto platforms folder -> enter into corresponding API(android-15) folder -> then create a folder named sources -> enter into sources and paste the folder that you have copied earlier.
Upvotes: 0
Reputation: 2872
If you're using Eclipse, you can go to Help > Install New Software and paste this link: http://adt-addons.googlecode.com/svn/trunk/source/com.android.ide.eclipse.source.update/
This is a plugin which attaches android source on Eclipse, the other way around is a bit complicated and I haven't tried, but you can do it following the URL below.
Upvotes: 10