Arab Ware
Arab Ware

Reputation: 9

How to sign apk file with v2 or v3 programmatically?

I have made an app that signs apk files with v1 signature programmatically , but I need a way to sign apk files with v2 or up (v3 .. v4) like apk signer (in play store)

My problem is I can't find a way to create my own v2 apk signer

Thanks in advance.

Upvotes: 0

Views: 712

Answers (2)

Gerges Shamon
Gerges Shamon

Reputation: 11

You can use the ApkSigner library

Find com.android.apksig.ApkSigner

Upvotes: 1

Gerges Shamon
Gerges Shamon

Reputation: 11

    try {
    com.android.apksigner.ApkSignerTool.main("sign --v1-signing-enabled --v2-signing-enabled --v3-signing-enabled --v4-signing-enabled --key key.pk8 --cert cart.x509.pem app.apk".split(" "));
} catch (Exception e) {
    
}

You can use this code to sign apk or aab file

Upvotes: 0

Related Questions