flutter build_error ai_generated true

Gradle task assembleRelease failed with exit code 1: Execution failed for task ':app:signReleaseBundle' > Key was created with a different algorithm (RSA) than expected (EC)

ID: flutter/gradle-sign-release-key-created

Also available as: JSON · Markdown · 中文
85%Fix Rate
84%Confidence
1Evidence
2023-08-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
Flutter 3.13.0 active
Android Gradle Plugin 8.0 active
Android Gradle Plugin 8.2 active

Root Cause

The signing key used for the release bundle was created with RSA algorithm but the Gradle configuration expects an EC (Elliptic Curve) key, or vice versa, due to a mismatch between the key type and the key store configuration.

generic

中文

用于发布包的签名密钥使用RSA算法创建,但Gradle配置期望EC(椭圆曲线)密钥,反之亦然,这是由于密钥类型与密钥库配置之间的不匹配。

Official Documentation

https://developer.android.com/studio/publish/app-signing

Workarounds

  1. 90% success Update the signing configuration in android/app/build.gradle to specify the correct key algorithm that matches the key store's key, e.g., keyAlgorithm 'RSA' or 'EC'.
    Update the signing configuration in android/app/build.gradle to specify the correct key algorithm that matches the key store's key, e.g., keyAlgorithm 'RSA' or 'EC'.
  2. 95% success Inspect the key store to determine the actual algorithm using keytool -list -v -keystore my-release-key.jks and then set the correct algorithm in build.gradle.
    Inspect the key store to determine the actual algorithm using keytool -list -v -keystore my-release-key.jks and then set the correct algorithm in build.gradle.
  3. 85% success If using Android App Bundle, switch to using Play App Signing and upload the original key to Google Play, then use the upload key for local builds.
    If using Android App Bundle, switch to using Play App Signing and upload the original key to Google Play, then use the upload key for local builds.

中文步骤

  1. Update the signing configuration in android/app/build.gradle to specify the correct key algorithm that matches the key store's key, e.g., keyAlgorithm 'RSA' or 'EC'.
  2. Inspect the key store to determine the actual algorithm using keytool -list -v -keystore my-release-key.jks and then set the correct algorithm in build.gradle.
  3. If using Android App Bundle, switch to using Play App Signing and upload the original key to Google Play, then use the upload key for local builds.

Dead Ends

Common approaches that don't work:

  1. Regenerate the key with the same algorithm as expected, but keep the same alias 60% fail

    This invalidates the old key and requires re-uploading to Google Play Console; also the error persists if the configuration is not updated.

  2. Delete the key store and create a new one with the correct algorithm 70% fail

    This loses existing signing credentials and may break CI/CD pipelines that rely on the old key.

  3. Set keyAlgorithm to RSA in build.gradle 80% fail

    If the actual key is EC, this still fails; the algorithm must match the key, not be hardcoded.