Android source debugging

I am new to Android and I am trying to debug a problem with an Android application (using Eclipse with the Android SDK).

I would like to enter the code of the Android platform (in particular, the code in Activity.class , more specifically the code in the startActivityForResult() method where the problem occurs), and I cannot correctly force Eclipse to find the code for Activity.class , so I can enter and see this source. This gives me “Source not found”, and I tried to connect android.jar from several places using the “Change attached source” button or through “Project properties”, but none of them work. (android.jar taken from the adt-bundle/sdk/platforms/android-7 folder, as well as the version taken from the prebuilts/sdk/7 repo folder.)

I create / debug using the Google 7 API (Android 2.1). The project is targeting Google API 7, and the target value is set for the Android virtual device.

I tried to specify the original attachment in a local directory containing Activity.java downloaded from the last repo ( frameworks/base/core/java/android ).

Should I try to get the version of this source directory used for Android 2.1 from the repo? Or is it a fact that I am creating Google API 7 (instead of Android open source 2.1)? Or are there some other android.jar that I should reference?

+6
source share
2 answers

If you use 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 that attaches the Android source to Eclipse, on the contrary, is a bit more complicated, and I have not tried it, but you can do it at the URL below.

+10
source

There is another easy way (although this cannot be used for v7 API)

This method can be used for all APIs that provide sources.

  • Download Sources for Android SDK for API.

  • Go to the sources folder in the android SDK and copy the downloaded source. For example: if you downloaded the source for API 15, your sdk will contain the names with the names of the sources, and all downloaded sources will be listed in this folder. So, copy the corresponding source folder (in this case android-15 will be named).

  • Now go to the platform folder → go to the appropriate API folder (android-15) → then create a folder called sources → enter into the sources and paste the folder you copied earlier.

0
source

All Articles