gpt4 book ai didi

android - Mac OS Flutter 构建 appbundle 失败 : Invalid keystore format

转载 作者:行者123 更新时间:2023-12-04 23:52:00 25 4
gpt4 key购买 nike

一周以来,我一直在尝试从一个 flutter 应用程序创建 android 应用程序包,并且我从 Create an upload keystore 开始关注给定flutter官方网站
在 Mac OS 中,我尝试在终端中执行以下命令

keytool -genkey -v -keystore ~/upload-keystore.jks -keyalg RSA -keysize 2048 -validity 10000 -alias upload
它提示我输入 keystore 密码,我写了 android然后重新输入新密码: android在我填写的一系列问题和答案之后,例如您的名字和姓氏?,您的组织单位的名称是什么?,您的组织名称是什么?,您所在的城市或地区的名称是什么?, 你所在的州或省的名称是什么?, 这个单位的两个字母的国家代码是什么?, 最后询问信息是否正确我回答是的, 它制作了.jks 文件同时这样提示
Generating 2,048 bit RSA key pair and self-signed certificate (SHA256withRSA) with a validity of 10,000 days
for: CN=Unknown, OU=Unknown, O=Unknown, L=Unknown, ST=Unknown, C=Unknown
[Storing /Users/faizfareed/upload-keystore.jks]
之后我创建了一个名为 [project]/android/key.properties 的文件包含对 keystore 的引用以及文件中的以下信息
storePassword=android
keyPassword=android
keyAlias=upload
storeFile=/Users/faizfareed/upload-keystore.jks
最后我已经配置了 gradle [project]/android/app/build.gradle文件。
android 之前添加了属性文件中的 keystore 信息堵塞:
   def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
...
}
加载 key.properties文件到 keystoreProperties目的。
替换了 buildTypes堵塞:
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now,
// so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
使用签名配置信息:
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
最后当我执行 flutter build appbundle命令,它给出这样的错误
faizfareed@Faizs-MBP building_apk % flutter build appbundle 

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:signReleaseBundle'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Failed to read key upload from store "/Users/faizfareed/upload-keystore.jks": Invalid keystore format

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

* Get more help at https://help.gradle.org

BUILD FAILED in 7s
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done 7.8s
Gradle task bundleRelease failed with exit code 1
作为引用,我还附上了终端的图片
enter image description here
我也试过关注 solution但没有什么对我有用
谁能帮我解决这个错误 无效的 keystore 格式

最佳答案

我只是有同样的错误。
我从 https://docs.oracle.com/en/java/javase/15/install/installation-jdk-macos.html#GUID-2FE451B0-9572-4E38-A1A5-568B77B146DE 安装了 JDK
但由于Android Studio有它,所以没有必要,所以我卸载了它。
我在终端中使用了下一个命令

/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home/bin/keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key
我建议使用命令
flutter doctor -v
检查java路径'Java二进制在:'
enter image description here

关于android - Mac OS Flutter 构建 appbundle 失败 : Invalid keystore format,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67663623/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com