Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging into Android source

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?

like image 953
ggprod Avatar asked Feb 01 '13 14:02

ggprod


People also ask

Is ADB open source?

The adb tool is part of the Android Open Source Project (AOSP).

How do I remotely debug my Android?

In the Address bar, go to edge://inspect . Connect your Android device directly to your development machine using a USB cable. The first time you try to connect, a prompt should be displayed about DevTools detecting an unknown device. Accept the Allow USB Debugging permission prompt on your Android device.

Can you debug an APK?

To start debugging an APK, click Profile or debug APK from the Android Studio Welcome screen. Or, if you already have a project open, click File > Profile or Debug APK from the menu bar. In the next dialog window, select the APK you want to import into Android Studio and click OK.


1 Answers

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.

  • Here goes the credit Source: http://www.mkyong.com/android/attach-android-source-code-to-eclipse-ide/
like image 174
Rigotti Avatar answered Sep 28 '22 18:09

Rigotti