Flutter:签署应用程序问题,在key.properties抛出异常中添加了使用Xamarin开发的应用程序的v.1中的先前密钥库

问题描述

打算在Play商店中部署当前应用的新版本。

我使用了旧的 .keystore 文件来对以前的应用进行签名,当我尝试在android文件夹下的key.properties文件添加元数据时,出现了以下异常

key.properties文件内容

storePassword=xxx
keyPassword=xxx
keyAlias=key
storeFile=C:/Users/Nike/**key.keystore**

失败:构建失败,并出现异常。

* What went wrong:
Execution Failed for task ':app:packageReleaseBundle'.
> java.util.concurrent.ExecutionException: java.lang.RuntimeException: jarsigner.exeFailed with exit code 1 :
  jarsigner: Certificate chain not found for: key.  key must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

在以前的其他应用程序分发版中,我生成一个 key.jks 文件,分发成功完成。

但是此应用已经拥有使用Xamarin开发的Play商店的第一个版本,现在使用Flutter开发的新版本需要先前的证书才能进行签名。

解决方法

发生此问题是因为 keyAlias = key 不正确。

> C:\Program Files\Java\jdk1.8.0_181\bin>keytool -v -list -keystore C:\Users\Nike\keyname.keystore

在java keytool位置下。 能够找到 keyname.keystore 的别名。

storePassword=xxx
keyPassword=xxx
keyAlias=newAliasName
storeFile=C:/Users/Nike/**key.keystore**

Flutter cleanflutter build appbundle创建应用程序包