How to debug signed Android app from Eclipse?

11,675

Solution 1

Set the debuggable=true in the manifest, export, install and sign the the app. Connect the device via USB, enable USB debugging. Then open the DDMS perspective, select the device and attach to your app's process (you will see the package name listed). If you have a rooted device, you can connect to any process if adb is running as root.

Solution 2

When device connect to your eclipse running mechine , set debuggable=true in manifest file and enable debug mode in android phone it can view current running log using logcat, otherwise

You can debug your running application using adb tools from the command line

adb logcat - View device log

will display the current logcat (debug messages)

adb logcat [ <filter-spec> ]

using you can filter only your given debug messages

for configure debug tool view http://developer.android.com/guide/developing/tools/adb.html

Solution 3

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

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

The first one will enable debugging of signed APK, and the second one will prevent compile-time error.

After this, you can attach to the process via "Attach debugger to Android process" button.

Share:
11,675

Related videos on Youtube

l33t
Author by

l33t

Updated on June 04, 2022

Comments

  • l33t
    l33t almost 2 years

    Android 2.2. I need to debug my signed APK on my Nexus S. How can this be done using Eclipse?

    I start the app on my phone and then...?

  • l33t
    l33t about 12 years
    Thanks. Unfortunately, afaik, debuggable must be set to false when using in-app billing (which is why I need to debug a signed app in the first place).
  • Nikolay Elenkov
    Nikolay Elenkov about 12 years
    Why must? Doesn't the Android Market/Paly console let you upload an APK with debuggable set to true?
  • l33t
    l33t about 12 years
    Logging is a the last resort. The insect works only for apps signed with the debug key. The main issue here is that my app needs to be signed.
  • l33t
    l33t about 12 years
    Hm, I read that somewhere. I'll test it and see if it works. I'll get back to you :)
  • Relsell
    Relsell about 12 years
    umm.. as far as I know... you can build a custom key store ... and then add that to your eclipse ... under windows->Preferences.... then during application run .. your apk will be signed with this custom key automatically .
  • AlikElzin-kilaka
    AlikElzin-kilaka over 10 years
    @NikolayElenkov - I Managed to activate the debugging and see the bug icon next to the app. The code even stops at breakpoints. The problem is that I don't see any code, but rather a new blank editor is shown :(
  • AlikElzin-kilaka
    AlikElzin-kilaka over 10 years
    I take that back. I restarted Eclipse and closed all other projects and it worked - the breakpoint stopped and showed me the code.
  • Maciek Czarnik
    Maciek Czarnik almost 10 years
    @user3093402 in AndroidManifext.xml in <application ... android:debuggable="true">
  • Maciek Czarnik
    Maciek Czarnik almost 10 years
    Ok, but still unable to send such build to Google Play "You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play."
  • Gene Bo
    Gene Bo over 8 years
    For my situation, this part did the trick "Then open the DDMS perspective, select the device and attach to your app's process (you will see the package name listed)" .. thanks!