为什么我无法在 Flutter 中构建签名的捆绑包版本?
Why am I unable to build a signed bundle release in Flutter?
我正在尝试在 运行 Flutter build appbundle --release
flutter doc 的帮助下制作应用程序包,但我总是收到此错误:
Execution failed for task ':app:validateSigningRelease'.
Keystore file 'C:\Users\MY_NAME\FlutterProjects\gym\android\app\Users\MY_NAME\key.jks'
not found for signing config 'release'.
我已经尝试了很多其他人 , here 和许多其他人回答的方法,但 none 对我有帮助。
我使用此命令构建密钥库
C:\Program Files\Android\Android Studio\jre\bin\keytool -genkey -v -keystore C:\Users\MY_NAME\FlutterProjects\gym\key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
文件保存在该路径中C:\Users\MY_NAME
我的 build.gradle 看起来像这样:
...
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('app/key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
...
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
...
signingConfig signingConfigs.release
P.S:我什至将 key.properties 文件放在 /android
和 /android/app
下,属性如下
但结果与上述错误相同
storePassword=MY_PWD
keyPassword=MY_PWD
keyAlias=key
storeFile=/Users/MY_NAME/key.jks
尝试在 key.properties 文件中给出完整路径。即
storePassword=MY_PWD
keyPassword=MY_PWD
keyAlias=key
storeFile=C:/Users/MY_NAME/key.jks
我正在尝试在 运行 Flutter build appbundle --release
flutter doc 的帮助下制作应用程序包,但我总是收到此错误:
Execution failed for task ':app:validateSigningRelease'. Keystore file 'C:\Users\MY_NAME\FlutterProjects\gym\android\app\Users\MY_NAME\key.jks' not found for signing config 'release'.
我已经尝试了很多其他人
我使用此命令构建密钥库
C:\Program Files\Android\Android Studio\jre\bin\keytool -genkey -v -keystore C:\Users\MY_NAME\FlutterProjects\gym\key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
文件保存在该路径中C:\Users\MY_NAME
我的 build.gradle 看起来像这样:
...
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('app/key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
...
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}
...
signingConfig signingConfigs.release
P.S:我什至将 key.properties 文件放在 /android
和 /android/app
下,属性如下
但结果与上述错误相同
storePassword=MY_PWD
keyPassword=MY_PWD
keyAlias=key
storeFile=/Users/MY_NAME/key.jks
尝试在 key.properties 文件中给出完整路径。即
storePassword=MY_PWD
keyPassword=MY_PWD
keyAlias=key
storeFile=C:/Users/MY_NAME/key.jks