首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >flutter build appbundle "FAILURE: Build failed with an exception“

flutter build appbundle "FAILURE: Build failed with an exception“
EN

Stack Overflow用户
提问于 2021-09-04 13:32:42
回答 1查看 239关注 0票数 0

我正在尝试将我的第一个Flutter应用程序安装到PlayStore上。我在Android上遵循下面的说明:

https://flutter.dev/docs/deployment/android

当我看到关于构建appbundle的说明时,我遇到一个错误:

代码语言:javascript
复制
flutter build appbundle
Running "flutter pub get" in weight_list...                         4.9s

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

Running Gradle task 'bundleRelease'...      

                  

















FAILURE: Build failed with an exception.

* Where:
Build file '/Users/michaelalbrecht/StudioProjects/weight_list/android/app/build.gradle' line: 29

* What went wrong:
A problem occurred evaluating project ':app'.
> No signature of method: java.util.Properties.exists() is applicable for argument types: () values: []
  Possible solutions: list(java.io.PrintStream), list(java.io.PrintWriter), wait(), equals(java.lang.Object), wait(long), equals(java.lang.Object)

* 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 4s
Running Gradle task 'bundleRelease'...                              5.9s
Gradle task bundleRelease failed with exit code 1
Process finished with exit code 1

它说问题在build.gradle的第29行。对于我来说,第29行是以下代码中的第三行,这是文档告诉我要添加的内容:

代码语言:javascript
复制
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystoreProperties.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

我在想key.properties文件有问题(这个文件应该是保密的,所以我不能和你分享)。但我遵循了文档中的说明,所以我不确定问题出在哪里。

有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-04 13:52:46

您将在keyStoreProperties上调用.exists(),而不是在keyStorePropertiesFile上。像这样更改第29行:

代码语言:javascript
复制
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69055794

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档