APK errors

Wrong key alias or password

Error text

Failed to read key release from store "/app/release.jks": Cannot recover key
Execution failed for task ':app:packageRelease'. > com.android.ide.common.signing.KeytoolException

Cause

The keystore opens, but the given alias is not found, or the key password differs from the keystore password.

Step-by-step fix

  1. Use keytool -list -keystore release.jks to see the real alias names.
  2. Match keyAlias letter for letter (case matters).
  3. storePassword and keyPassword can be two different passwords; check both.
  4. Read passwords from gradle.properties or environment variables, not from code.
  5. ./gradlew signingReport shows which signature is used.

Example commands

keytool -list -keystore release.jks
./gradlew signingReport
# gradle.properties (git-ə qoyma)
KEY_ALIAS=release
KEY_PASSWORD=****

How to prevent it

Document the alias and passwords together with the signing key.

Author and license: Nibras Code