Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug apk signed for release?

I have an apk which I've signed and uploaded to Android Market, and installed on my phone. I would like to debug this release apk (by means of Eclipse) whilst it is running on my phone. I have done this before (and remember it being with one of the Android development tools; perhaps Dalvik Debug Monitor) but unfortunately cannot remember how to do it and have been unable to find any articles online. Does anyone know how this can be done?

Note: I have set android:debuggable="true" in the manifest and have enabled USB Debugging on my phone.

like image 383
Adil Hussain Avatar asked Jan 31 '12 15:01

Adil Hussain


People also ask

How do I debug a release app?

Click on the package name, and in the top right of the Devices view you should see a green bug along with a number of other small buttons. Click the green bug. You should now be attached/debugging your app.

What is the difference between debug APK and release APK?

Major differences are the debug apk and the release apk: For debug builds the apk will be signed with the default debug signing keys with debug flag enabled. For release apk you will have to explicitly specify the apk to sign with and the debug flag will be turned off so that it cannot be debugged.


2 Answers

I know this is old question, but future references. In Android Studio with Gradle:

buildTypes {     release {         debuggable true         minifyEnabled true         proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'     } } 

The line debuggable true was the trick for me.

Before Gradle 1.0 it was runProguard instead of minifyEnabled. Look at here.

like image 118
Manuel Lopera Avatar answered Nov 06 '22 00:11

Manuel Lopera


Be sure that android:debuggable="true" is set in the application tag of your manifest file, and then:

  1. Plug your phone into your computer and enable USB debugging on the phone
  2. Open eclipse and a workspace containing the code for your app
  3. In Eclipse, go to Window->Show View->Devices
  4. Look at the Devices view which should now be visible, you should see your device listed
  5. If your device isn't listed, you'll have to track down the ADB drivers for your phone before continuing
  6. If you want to step through code, set a breakpoint somewhere in your app
  7. Open the app on your phone
  8. In the Devices view, expand the entry for your phone if it isn't already expanded, and look for your app's package name.
  9. Click on the package name, and in the top right of the Devices view you should see a green bug along with a number of other small buttons. Click the green bug.
  10. You should now be attached/debugging your app.
like image 33
Sam Dozor Avatar answered Nov 05 '22 23:11

Sam Dozor