flutter build_error ai_generated true

Gradle任务assembleRelease失败,退出代码1:任务':app:signReleaseBundle'执行失败 > 密钥使用的算法(RSA)与预期(EC)不同

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

其他格式: JSON · Markdown 中文 · English
85%修复率
84%置信度
1证据数
2023-08-20首次发现

版本兼容性

版本状态引入弃用备注
Flutter 3.13.0 active
Android Gradle Plugin 8.0 active
Android Gradle Plugin 8.2 active

根因分析

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

English

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

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

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

    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% 失败

    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% 失败

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