I build my app with the following line
ionic cordova build android --prod --release
This creates an 'app-release-unsigned.apk' file. I have a 'keystore.jks' file available and although everywhere I find people talking about .keystore files, I assume this is the file I need to sign it.
Following things I tried:
1. Build with a build.json file
ionic cordova build android --prod --release --BuildConfig=build.json
Json content:
{
"android":
{
"release":
{
"keystore": "keystore.jks",
"storePassword": "************", // Filled in password
"password" : "************", // Filled in password
"alias" : "**" // Also tried removing this line, didn't make any difference
}
}
}
Problem: There build was still unsigned. (I tried also solving this with option 2)
2. Sign apk with jarsigner command
I tried executing the following command at the root of my app, where the keystore file is placed as well.
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore keystore.jks platforms/android/app/build/release/apk/app-release-unsigned.apk bp
Problem: after this command, it asks for Enter Passphrase for keystore
. I tried filling in my password and storepassword, but then I get the error jarsigner error: java.lang.RuntimeException: keystore load: Keystore was tampered with, or password was incorrect
I also tried running the jarsigner command with keypass and storepass as flags, but that also didn't work.
I'm pretty sure my password is correct.
Lastly I see you could use Android Studio to build a generated APK. Only this option is not available to me in the Android Studio build menu. I'm using SDK Api level 28.
TL;DR: Can't build signed app, have no clue why.
question from:
https://stackoverflow.com/questions/65844235/issues-with-signing-apk-with-keystore-jks-built-with-ionic-cordova 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…