1

I made a signed APK and installed it on the device (Galaxy S5). The run the app and tried to attach to it from IntelliJ IDEA 13.1. But IDEA cannot see any process on my device

You can see that part belonging to the device is empty.

If I install the debug version of the app, then I can attack the debugger to it. But not if it's been created as a signed APK.

Where am I making a mistake? Why I cannot debug signed APK?

sandalone
  • 41,141
  • 63
  • 222
  • 338
  • possible duplicate of [How to debug apk signed for release?](http://stackoverflow.com/questions/9081877/how-to-debug-apk-signed-for-release) – rds Apr 10 '15 at 13:51

3 Answers3

3

Have you set android:debuggable="true" in the application tag of your manifest file? Also, take a look at How to debug apk signed for release?

Community
  • 1
  • 1
Vino
  • 1,544
  • 1
  • 18
  • 26
  • No I did not. After I did it, I can attach to the process on the device, but I don't get any data from it. I forced a crash, and it was not caught by logcat inside intellij. Any more ideas? – sandalone Jul 11 '14 at 12:46
  • You said `but I don't get any data from it`. What do you mean by that? And how did you force the crash? – Vino Jul 11 '14 at 13:14
  • It means I attach to the process and don't receive and `Log.d` messages from the app, or any other messages. Intentional crash = made the code which I know will produce runtime error, like send `int` if `String` is expected. – sandalone Jul 11 '14 at 14:37
  • 1
    The Android docs for [Log](http://developer.android.com/reference/android/util/Log.html) says `Debug logs are compiled in but stripped at runtime. Error, warning and info logs are always kept.`. Perhaps that could be the reason. – Vino Jul 12 '14 at 02:17
  • Thank for the info. However, this does not say why I get no response when error occurs (app crashes). – sandalone Jul 12 '14 at 08:25
1

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.

sandalone
  • 41,141
  • 63
  • 222
  • 338
0

If the app is signed and installed over the Google play store, attaching to a process is not allowed. Currently the Google play store rejects the upload of any apk with:

android:debuggable="true"

Kowi
  • 211
  • 3
  • 6