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

- **ID:** `flutter/gradle-sign-release-key-created`
- **领域:** flutter
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Flutter 3.13.0 | active | — | — |
| Android Gradle Plugin 8.0 | active | — | — |
| Android Gradle Plugin 8.2 | active | — | — |

## 解决方案

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.
   ```

## 无效尝试

- **Regenerate the key with the same algorithm as expected, but keep the same alias** — This invalidates the old key and requires re-uploading to Google Play Console; also the error persists if the configuration is not updated. (60% 失败率)
- **Delete the key store and create a new one with the correct algorithm** — This loses existing signing credentials and may break CI/CD pipelines that rely on the old key. (70% 失败率)
- **Set keyAlgorithm to RSA in build.gradle** — If the actual key is EC, this still fails; the algorithm must match the key, not be hardcoded. (80% 失败率)
