How to Debug APK Signed for Release

How to debug apk signed for release?

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.

Is it possible to debug a app that was signed and installed as a release build?

Release versions are usually optimizated versions and all Debug symbols and references are removed during compilation time.
Even "row numbers" are lost, so it's not possible for a Debugger to let Source and Runtime in sync without any debugging information.

So finally answer is No.

How to Debug an APK Signed Release? (Using VS Code for development)

Looking at this post it would appear that you can add a signing config to your debug build configuration in build.gradle. This should allow you to not worry about having to generate the release apk and trying to debug that. However if that doesn't solve the problem for you, you should be able to mark the release build with debuggable true and minifyEnabled false, then attach VS code to a running process on android.

Debugging The Release Build Type Without Generating a Signed APK

After a lot of research I decided to go ahead with my debugRelease idea and it seems to be working well.

I create a new directory under app/src called debugRelease/java. In there I put any code that I wanted to be different when I generated a signed apk or release version.

Doing so enables me to test the code works and be able to debug it. Granted this isn't done very often and it's only crash reporting and logging differences but, on the off chance I need to fix a bug or something, I can.

In my build.gradle file, I have the following setup.

buildTypes {
release {

}

debug {

}

debugRelease {
signingConfig signingConfigs.debug
}
}

sourceSets {
debugRelease {
res.srcDirs = ['src/debug/res'] // this uses the debug's res directory which contains a "debug" icon
}

release {
java.srcDirs = ['src/debugRelease/java'] // this avoids copying across code from the debugRelease java directory
}
}

So now when I want to test the release code, I just change my build variant to debugRelease.

How we can debug a signed apk without having source code?

You can debug an already signed APK with a number of different tools. Most approaches would be considered a form of reverse engineering. At a high level, a common approach (for dynamic "live" debugging) would be to:

  1. Use APKTool to enable debugging via the property in the AndroidManifest.xml. Align and sign the newly modified APK.
  2. Use ADB to push the new "debuggable" APK to the device/emulator.
  3. Use a debugger such as GDB (NDK includes a gdbserver with the arm toolchain).

It's worth mentioning that static analysis can be an option too, whereby the APK could be unpacked and decompiled to SMALI/Java.

There are a number of tools available to help reverse and debug APK's. Some I use frequently are; dex2jar, JDGUI, APK Studio, JEB, IDA Pro, VisualGDB.

You have sent a signed APK or Android App Bundle in debug mode. Sign it in release mode. How to fix it (flutter)

Remove the duplicate buildType release

    buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now,
// so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}

Or rename to debug.

buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}

Why signed release APK does not allow user to sign in but built debug apk does?

You might have enabled obfuscation (R8) for release builds and not written the required -keep rules for it. Without a stack-trace this is quite a theoretical question, but likely it would show a ClassNotFoundException, because the name of some class or class member had been obfuscated, which shouldn't have been obfuscated.



Related Topics



Leave a reply



Submit