android-studioandroid-gradle-pluginlaunching-applicationandroid-app-signing

Updated to Android Studio 4.2, Try to generate Signed Bundle / APK. "Failed to read key from keystore" and "Given final block not properly padded."


I am trying to publish my Android Studio app again. I just updated Android studio and of course, it automatically forgets any old keys and passwords to publish the app. However, I have stored the passwords separately, so I know they are correct when I enter them again.

I have also tried to open my keystore file directly on my Mac with my keystore password and it works so it also confirms that the keystore password is correct.

I have also tried uninstalling and reinstalling Android Studio from scratch.

Also, when I try to generate just the APK or just "Signed bundle" it all works fine. It only happens when I choose "signed bundle / apk"

I have tried to copy-paste the correct passwords and also to type them out. However, it always gives me the same error once I enter the correct key password and key store password. It says:

Execution failed for task ':app:signReleaseBundle'. A failure occurred while executing com.android.build.gradle.internal.tasks.FinalizeBundleTask$BundleToolRunnable Failed to read key myKey from store "/Users/blabla/Desktop/blabla/appkeys/keystore.jks":

Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.

When I try to run it with the full stack trace (--stacktrace), as recommended by Android Studio, it completes running with zero errors.

How do I solve this and publish my app again?


Solution

  • Try to use same password for the keystore and the key.