flutter build_error ai_generated true

Gradle task assembleRelease failed with exit code 1: Execution failed for task ':app:signReleaseBundle' > Key was created with errors: Key not found: /path/to/keystore

ID: flutter/gradle-task-assemble-release-signature-mismatch

Also available as: JSON · Markdown · 中文
85%Fix Rate
85%Confidence
1Evidence
2024-03-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Flutter 3.10 active
Android Gradle Plugin 8.1 active
Gradle 8.2 active

Root Cause

The keystore file specified in build.gradle for signing the release bundle does not exist at the given path.

generic

中文

build.gradle中指定的用于签署发布包的密钥库文件在给定路径下不存在。

Workarounds

  1. 90% success Verify the keystore path in android/app/build.gradle and ensure the file exists. Example: storeFile file('../keystores/release.jks') should point to an existing file. Move the keystore to the correct location or update the path.
    Verify the keystore path in android/app/build.gradle and ensure the file exists. Example: storeFile file('../keystores/release.jks') should point to an existing file. Move the keystore to the correct location or update the path.
  2. 85% success If using environment variables, check that the variable is set correctly. Run 'echo $KEYSTORE_PATH' in terminal to confirm. In build.gradle, use storeFile file(System.getenv('KEYSTORE_PATH')).
    If using environment variables, check that the variable is set correctly. Run 'echo $KEYSTORE_PATH' in terminal to confirm. In build.gradle, use storeFile file(System.getenv('KEYSTORE_PATH')).
  3. 95% success Generate a new keystore if the old one is lost: 'keytool -genkey -v -keystore release.jks -keyalg RSA -keysize 2048 -validity 10000 -alias release' and update build.gradle accordingly.
    Generate a new keystore if the old one is lost: 'keytool -genkey -v -keystore release.jks -keyalg RSA -keysize 2048 -validity 10000 -alias release' and update build.gradle accordingly.

中文步骤

  1. Verify the keystore path in android/app/build.gradle and ensure the file exists. Example: storeFile file('../keystores/release.jks') should point to an existing file. Move the keystore to the correct location or update the path.
  2. If using environment variables, check that the variable is set correctly. Run 'echo $KEYSTORE_PATH' in terminal to confirm. In build.gradle, use storeFile file(System.getenv('KEYSTORE_PATH')).
  3. Generate a new keystore if the old one is lost: 'keytool -genkey -v -keystore release.jks -keyalg RSA -keysize 2048 -validity 10000 -alias release' and update build.gradle accordingly.

Dead Ends

Common approaches that don't work:

  1. 95% fail

    The keystore path is hardcoded and cleaning the build does not create the keystore file.

  2. 85% fail

    The error is about the file path, not the password; password changes are irrelevant.

  3. 90% fail

    The keystore file is not inside the build folder; it's a separate file that must exist externally.