I want to debug my app from my phone. How do I sign my app so I can do this? I don't know much about the manifest.
Asked
Active
Viewed 8.8k times
53
-
Now the correct way is this one: [Full explanation][1] [1]: http://stackoverflow.com/a/4580630 – Apr 15 '15 at 10:17
2 Answers
57
By putting android:debuggable="true"
in your manifest file, application will go in debug mode, that means android will manage all logs file regarding your application. But make sure put it again false
(or remove this tag) if application will going to live or for release mode.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
...
<application android:icon="@drawable/icon"
android:debuggable="true"

jjmerelo
- 22,578
- 8
- 40
- 86

drawnonward
- 53,459
- 16
- 107
- 112
-
14This is not needed and neither this is recommended anymore. In fact, the tools automatically insert "debuggable=true" flag when building an APK to debug in emulator or device and on release you dont have to worry about removing this flag. So just running in debug mode or attaching debugger will do the needful if you are using Android Studio (Which is the recommended IDE anyways.) – ND27 Oct 06 '16 at 18:43
-
3This is still useful for Cordova based applications where a user wants a debuggable 'release' application for testing features such as in-app purchases – ganey Jun 20 '18 at 09:34
-
2@ND27 wrong. As Ganey have said, it is useful when you want to debug a release/optimized version of the app regardless if it's Hybrid, Xamarin or Native. On the other hand, you should remove this attribute upon uploading it into production for security reasons and PlayStore won't allow it as well. – mr5 Jun 10 '19 at 06:27
-
Also helpful when reverse engineering an android app. works like a charm – Gursewak Dhindsa Oct 11 '22 at 09:23
56
With the new Gradle build system, the recommended way is to assign this in the build types.
In your app module's build.gradle
:
android {
//...
buildTypes {
debug {
debuggable true
}
customDebuggableBuildType {
debuggable true
}
release {
debuggable false
}
}
//...
}

Christian García
- 3,939
- 1
- 26
- 26