Tristan
Tristan

Reputation: 9141

How to check if an APK/AAB binary was signed in debug mode?

Let's say I am responsible of a tool to publish APK/AAB to play store and I need to do some pre-checks before doing so.

How can my tool check if an APK/AAB binary has been signed in "debug mode" ?

Note : to be clear, I don't need a process to sign it in "release mode" like in all other answers, I need the full check procedure to know if the APK/AAB will be refused by play store, so I can refuse it.

Upvotes: 1

Views: 2798

Answers (2)

saradruid
saradruid

Reputation: 21

Prerequisite is bundletool, you can run brew install bundletool to install it After that run the following command in terminal, the result ist 0 if your .aab file is release otherwise 1:

bundletool dump manifest --bundle= yugPathToYourAABFile | grep -c android:debuggable="true"

if output is 0, bundle tool didnt find the android:debuggable="true" tag 1 means tag is found You can also take ref from the following android doc:

Whether or not the application can be debugged, even when running on a device in user mode — "true" if it can be, and "false" if not. The default value is "false". ```

Upvotes: 2

Tristan
Tristan

Reputation: 9141

Here is a first answer, waiting for better :

jarsigner -verify -certs -verbose my.aab > presign.txt

Now my.aab is in debug mode if and only if "presign.txt" contains "CN=Android Debug, O=Android, C=US".

Upvotes: 2

Related Questions