How to debug apk signed for release?

I have an apk that I signed up and downloaded on the Android Market, and installed on my phone. I would like to debug this version of apk (using Eclipse) while it works on my phone. I did this before (and I remember that it was one of the Android development tools, perhaps the Dalvik Debug Monitor), but, unfortunately, he does not remember how to do this, and could not find any articles on the Internet. Does anyone know how to do this?

Note: I set android:debuggable="true" in the manifest and turned on USB debugging on my phone.

+97
android google-play
Jan 31 2018-12-12T00:
source share
6 answers

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

  • Connect the phone to the computer and enable USB debugging on the phone.
  • Open eclipse and the workspace containing the code for your application.
  • In Eclipse, open Window-> Show View-> Devices
  • Look at the kind of devices that should now be visible, you should see that your device is indicated
  • If your device is not listed, you will need to track the ADB drivers for your phone before proceeding.
  • If you want to execute code, set a breakpoint somewhere in your application
  • Open the application on your phone
  • In the Devices view, expand the entry for your phone, if it is not already expanded, and find the name of your application.
  • Click on the package name and in the upper right corner of the "Devices" window you will see a green error along with a number of other small buttons. Click the green error.
  • Now you need to connect / debug the application.
+67
Jan 31 '12 at 15:42
source share

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

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

The debuggable true was a trick for me.

Update:

Since gradle 1.0 it is minifyEnabled instead of runProguard . Look here

+110
Nov 28 '14 at 3:43
source share

Aside from Manuel’s path, you can still use the manifest.

In Android Studio stable, you should add the following 2 lines to the application in the AndroidManifest file:

  android:debuggable="true" tools:ignore="HardcodedDebugMode" 

The first option will allow you to debug a signed APK, and the second will prevent a compile-time error.

After that, you can connect to the process using the "Attach Debugger to Android Process" button.

+38
Jan 27 '15 at 20:37
source share

I tried with the following and worked:

 release { debuggable true minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } 
+8
Sep 12 '17 at 7:10
source share

Add the following to your build.gradle application and select the specified release build option and run

 signingConfigs { config { keyAlias 'keyalias' keyPassword 'keypwd' storeFile file('<<KEYSTORE-PATH>>.keystore') storePassword 'pwd' } } buildTypes { release { debuggable true signingConfig signingConfigs.config proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } 
+6
Nov 16 '18 at 6:57
source share

In case you decide to debug your apk, which is already on the market, but not assigned for debugging, and you do not want to publish it again. So follow the steps below;

  1. Decompile Apk with ApkTool (e.g. apktool d <APK_PATH> )
  2. Open AndroidManifest.xml from decompiled files
  3. Set android:debuggable="true" in the application tag
  4. Compile the modified source using ApkTool (e.g. apktool b <MODIFIED_PATH> )
  5. Debuggable apk ready (which means the unsigned cannot publish the repository). You can debug as you want.
0
Aug 05 '19 at 6:20
source share



All Articles