# Gradle任务assembleRelease失败，退出代码1：任务':app:signReleaseBundle'执行失败 > 密钥是用与所用别名不同的别名创建的

- **ID:** `flutter/android-signing-key-created-with-incorrect-alias`
- **领域:** flutter
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

密钥库文件包含一个别名与`build.gradle`中签名配置指定的别名不匹配的密钥，通常是由于使用了不同的密钥库或重新生成了密钥。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Flutter 3.13.0 | active | — | — |
| Flutter 3.19.0 | active | — | — |
| Flutter 3.22.0 | active | — | — |

## 解决方案

1. ```
   List aliases in the keystore using `keytool -list -keystore your-keystore.jks -storepass your-storepass` and update the `keyAlias` in `android/app/build.gradle` to match.
   ```
2. ```
   If the alias is correct, ensure the keystore path and passwords are correct in `key.properties` and `build.gradle`.
   ```
3. ```
   Recreate the keystore with the exact alias specified: `keytool -genkey -v -keystore release-key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias your-alias`.
   ```

## 无效尝试

- **** — This invalidates the old signing key, which may cause issues with app updates on the Play Store. (80% 失败率)
- **** — This will still not match the actual alias in the keystore; the alias must match exactly. (90% 失败率)
- **** — This bypasses the error but uses a debug key for release, which is insecure and not allowed for Play Store upload. (95% 失败率)
