Android Studio. Building signed APK. Get Key Failed
Asked Answered
U

5

18

I've been building release versions of my app for months, and now all of a sudden I get this error.
Failed to read key ******** from store ***** Get Key Failed. Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
This is beyond frustrating.

What I've done so far

  1. Read every post on this error and tried every solution
  2. Verified my passwords are correct
  3. Checked and unchecked "save passwords"
  4. Verified my keystore location is correct
Unsustainable answered 12/6, 2021 at 13:59 Comment(5)
Try using the same password for the key and keystore file.Could
OMG! that worked. You are awesome. Post it and I'll accept it. I'm also going to see if it's possible to donate some of my reputation to you.Unsustainable
Not related but @SamChen answer also worked when trying to use codemagic (a ci-cd service ) to build my Flutter app.Conspicuous
No doubt, the fact that this works suggests a bug in Android Studio. Don't worry: Google may fix the bug one day.Unsure
Maybe an explanation for the "same" password for the keystore and the alias: If your keystore format is JKS, you can have different passwords, but if the format is PKCS12, there is a single password to be used for the keystore and the alias. You can view the format from the command line: keytool -list -keystore store.jksMonster
C
51

If you get error like block not properly padded, bad key or PKCS12 when signing the App Bundle or APK, try using the same password for the key and the keystore file, it works for me.

Could answered 12/6, 2021 at 20:15 Comment(7)
And could you explain why they have to be the same?Rotor
@Rotor I actually don't know, you can create a post for that.Could
It's worked. But doesn't know why.Leclerc
Same here. To be clear, I had to use the keystore password in the "Key password" field, instead of the key's passwordPortage
Worked for me. But I am somehow very irritated with this requirement.Lattermost
Blocked for a while building releases, this unblocked me, just wondering why this works? 🤔Tachograph
Oh my god I just wasted like 3 hours because of several errors that all in the end led up to this 🤦🏼‍♂️Kelleher
S
5

Recently, Android Studio started to show a message: "Warning: Different store and key passwords not supported for PKCS12 KeyStores. Ignoring user-specified -keypass value. in Android Studio" - so, first of all, store and key passwords should be the same, like other people said.

Besides, after getting this error even using the same password, I realized that we can't use characters like @ or $ on the passwords.

Selector answered 11/2, 2022 at 20:2 Comment(1)
I ran into this error having two different passwords. Setting up the same password and removing @ and $, solved the errorHoarfrost
I
0

In my case it was because of ! symbol. It's so weird that I was able to create bundle with this password but can't create a next one.

Unfortunately I have to reset my key. Here is where it in the console:

Setup -> App signing -> Request upload key reset

enter image description here

Iconology answered 5/1 at 20:17 Comment(0)
H
0

I use '@' inside the password and get that error. But i repeat the same exact password and alias again, and the errors gone.

I think its something random on the key generation process. Everytime you create the key, you need to confirm whether it could be decrypted.

Haeres answered 5/6 at 5:25 Comment(0)
O
-3

Just Remove space from folder name ,where your jks file stored

Ocker answered 4/7, 2022 at 18:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.