flutter - 未找到用于签名配置 'release' 的 keystore

标签 flutter dart build apk keystore

我在 Flutter 上运行此命令时遇到问题:flutter build appbundle --target-platform android-arm,android-arm64,android-x64我需要运行它才能执行 flutter build apk .

构建.gradle

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('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']
       }
    }

    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.release
        }
    }

key.properties
storePassword=XXXX
keyPassword=XXXX
keyAlias=key
storeFile="C:/Users/User/Key/key.jks"


错误:
* What went wrong:
Execution failed for task ':app:validateSigningRelease'.
> Keystore file 'D:\Projects\Flutter\iusefully\android\app\"C:\Users\User\Key\key.jks"' not found for signing config 'release'.

最佳答案

终于找到答案了
我的问题出在 key.properties文件。
出现问题是因为我使用了storeFile="LOC".jks路径的这个变量的声明不应该在 " "引述。

错误的:storeFile="C:/Users/User/Key/key.jks"
右:storeFile=C:/Users/User/Key/key.jks
另外,我添加了key.jks文件到 /app文件夹。

关于flutter - 未找到用于签名配置 'release' 的 keystore ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62173655/

相关文章:

flutter - Flutter Bloc:更新状态不会重新调用BlocBuilder

dart - 如何使用 Dart 语言获取所有子元素的数组?

javascript - 在 Sublime Text 中模拟警报

c++ - Qt 5 是否支持异常?

flutter - 当应用程序关闭/终止或屏幕关闭时,如何让 Flutter 应用程序在后台每 10 秒连续运行一次获取数据

Flutter 将数学方程转换为数学图像

flutter - 自定义 Sliver App Bar 在滚动时带有图像和 2 个文本小部件进入应用程序栏

flutter - 在 dart 文档注释中使用本地镜像资源

c++ - 将 C++ (qt) 程序构建为一个具有内置依赖项的可移植文件

android-studio - 运行命令 "flutter run"时出错