DEV Community

Hodeem
Hodeem

Posted on • Edited on

4

Tidbit: com.android.ide.common.signing.KeytoolException: Failed to read key <alias> from store "C:\..\<keystore-name>.keystore"

When attempting to create the release bundle for a React Native app, I followed the steps in the (guide)[https://reactnative.dev/docs/signed-apk-android] and generated the keystore. However, when I ran this command to create the release AAB:

cd android
./gradlew bundleRelease
Enter fullscreen mode Exit fullscreen mode

I encountered an error message with the following syntax:

* What went wrong:
Execution failed for task ':app:packageRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
   > com.android.ide.common.signing.KeytoolException: Failed to read key <alias> from store "C:\Users\...\<keystore-name>.keystore": Get Key failed: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.
Enter fullscreen mode Exit fullscreen mode

Given that there was no instruction from the CLI to create a key password, this might be a bit confusing.
The solution is to use the keystore password in the key password field in your build.gradle file. For example,

MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=<keystore-password>
MYAPP_UPLOAD_KEY_PASSWORD=<keystore-password>
Enter fullscreen mode Exit fullscreen mode

The reason why this works is that different store and key passwords are not supported for PKCS12 keystores.

If you liked this article, then please support me

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more