我正在尝试将我的第一个Flutter应用程序安装到PlayStore上。我在Android上遵循下面的说明:
https://flutter.dev/docs/deployment/android
当我看到关于构建appbundle的说明时,我遇到一个错误:
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行是以下代码中的第三行,这是文档告诉我要添加的内容:
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystoreProperties.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}我在想key.properties文件有问题(这个文件应该是保密的,所以我不能和你分享)。但我遵循了文档中的说明,所以我不确定问题出在哪里。
有什么想法吗?
发布于 2021-09-04 13:52:46
您将在keyStoreProperties上调用.exists(),而不是在keyStorePropertiesFile上。像这样更改第29行:
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}https://stackoverflow.com/questions/69055794
复制相似问题