What are some ways to debug third party android apps (apps you don't have the source code to)? I would like to step through the APK instruction by instruction, and possibly set breakpoints on certain APIs or certain smali instructions.

I've tried decompiling with apktool, loading into netbeans, and the connecting to the emulator, and I've also tried using IDA Pro, but I always get errors along the lines of "JDWP error: Connection reset by peer". I've tried with both the default Android emulator and Genymotion with Android 5.0.1.

Has anyone had any success with this? Could you describe your setup and tools that you used?

  • When all else fails, there's always printf (i.e. Log.e) debugging.
    – Antimony
    Commented Sep 19, 2015 at 0:18

1 Answer 1


To debug an APK without the source code, you need to perform the following:

  1. Enable debug mode in the APK (use apktool to achieve this)
  2. Sign the APK (use keytool and jarsigner)
  3. Install the app and identify the debug port of the app using Android Debug Monitor or DDMS
  4. Use an IDE with support for JDWP like NetBeans pointing to the project with the decompiled java or smali.

You can find the commands yo use in this blog (section 5 Dynamic analysis and debugging) First steps performing penetration testing on an Android application

  • I tried this, but I'm not able to set breakpoints. I made sure to both decompile and build in debug mode. Here's the error: Not able to submit breakpoint LineBreakpoint ChessFreeActivity$1.java : 28, reason: No executable location available at line 28 in class uk.co.aifactory.chessfree.ChessFreeActivity$1.
    – gsgx
    Commented Sep 24, 2015 at 6:51
  • It means the code in your project and the IDE is not in sync. Decompiled code will probably not allow this. Use the smali and try Intellij if it works.
    – 3asm_
    Commented Sep 24, 2015 at 23:13
  • What do you mean by use the smali? I thought we had to use the "fake" Java code produced by apktool -d, otherwise the IDE wouldn't recognize it. Can you add smali as source files in Intellij?
    – gsgx
    Commented Sep 24, 2015 at 23:38
  • 2
    @gsingh2011 check this: github.com/JesusFreke/smali/wiki/smalidea
    – Behrouz.M
    Commented Feb 27, 2017 at 10:10
  • @pixar great tool, too bad it is not maintained anymore.
    – 3asm_
    Commented Jan 6, 2018 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.