10

As the title says, I'd like to be able to find whether an APK has debuggable set to true or false on a computer without having to install it on the device, run it and see whether it shows up in DDMS or not.

kabuko
  • 36,028
  • 10
  • 80
  • 93

3 Answers3

20

This is one of those "easy once you know how" things - Use the aapt tool to inspect the manifest.

aapt dump xmltree YourApp.apk AndroidManifest.xml | grep debuggable

That command will give you a dump of the compiled form of the AndroidManifest.xml file- the output will look something like

A: android:debuggable(0x0101000f)=(type 0x12)0x0

(Actual output from my command prompt) in that example, the 0x0 indicates false.

Alexander Lucas
  • 22,171
  • 3
  • 46
  • 43
  • Thanks, I just found an alternate method with `l -a` too. – kabuko Nov 17 '11 at 01:46
  • 3
    If you want to know the state of the debuggable flag in the manifest you can do as @Alexander suggests. However, if you want to know if an apk is actually debuggable, you also need to see if the `grep` is empty. If your manifest has no debuggable flag, it will default to false. From the docs: `You can disable debugging by removing the android:debuggable attribute from the tag in your manifest file, or by setting the android:debuggable attribute to false in your manifest file.` You can always just look at the whole manifest by removing `| grep debuggable` from the above code. – tir38 Jun 22 '14 at 02:01
15

Apparently aapt can do it:

aapt l -a app.apk | grep debuggable

will return either:

A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff (means debuggable is true)

or

A: android:debuggable(0x0101000f)=(type 0x12)0x0 (means debuggable is false)
Almo
  • 15,538
  • 13
  • 67
  • 95
kabuko
  • 36,028
  • 10
  • 80
  • 93
5

For window user can use following command:

aapt l -a <apk with path> | findstr debuggable

will return either:

A: android:debuggable(0x0101000f)=(type 0x12)0xffffffff
-> this means debuggable is true.

or

A: android:debuggable(0x0101000f)=(type 0x12)0x0
-> this means debuggable is false.
BSavaliya
  • 809
  • 1
  • 16
  • 26
  • 5
    For me at least this returned nothing! – Jake Lee Oct 25 '18 at 10:23
  • 2
    If it returns nothing, that means the `debuggable` flag is not explicitly set, so the debuggable flag defaults to false, according to the android docs: https://developer.android.com/guide/topics/manifest/application-element – Norman Breau May 22 '20 at 12:38