Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Signing apk works from Android Studio but why the same keystore do not work on command line?

My key for signing Android app was generated using Android Studio. It is working fine when I try to generate signed APK from Android Studio.

However the same key is not working when I try to sign using apksigner tool. Here is the command I am using.

apksigner sign --ks mykey.jks --ks-key-alias MyAlias --out app-myapp-release.apk app-myapp-release-aligned.apk

I am getting below errors:

java.io.IOException: Keystore was tampered with, or password was incorrect

Any suggestions?

** Update ** Android Studio Version 2.2.3 The keystore was generated using "Generate Signed APK" dialog box from Build menu.

like image 906
Nagarjun Avatar asked Jan 05 '23 19:01

Nagarjun


1 Answers

I just had this exact problem, and many more while trying to sing an apk.

Try to add these options to your sign command:

--ks-pass stdin  --key-pass stdin

Now you can normally type in your keystore password and your key (alias) password in that order.

like image 122
Nemanja Kovacevic Avatar answered Feb 01 '23 10:02

Nemanja Kovacevic