How can I detect whether an Android APK has debugg

2019-02-05 04:42发布

问题:

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.

回答1:

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.



回答2:

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)


回答3:

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.