关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。
此问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是 on-topic在这里,这个问题的解决方式不太可能帮助 future 的读者。
2年前关闭。
Improve this question
我的 Flutter 应用无法构建调试版本。我用签名 key 很好地构建了发布,但现在尝试构建调试它正在寻找 storeFile(它不存在,因为我已经将代码带到了另一台没有 key 的机器上)。我正在运行:
flutter build apk --debug
但它失败了
Error running Gradle: ProcessException: Process ...\android\gradlew.bat" exited abnormally:
FAILURE: Build failed with an exception.
Where: Build file ...\android\app\build.gradle' line: 54
What went wrong: A problem occurred evaluating project ':app'. path may not be null or empty string. path='null'
第 54 行在用于签名配置的版本中
storeFile file(keystoreProperties['storeFile'])
不应该 --调试忽略这个?当这是一个调试版本时,为什么它试图访问该文件?
这是带有注释的版本的 build.gradle 文件,因此我可以在没有 keystore 的情况下构建调试:
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.6'
}
apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}
android {
compileSdkVersion 28
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId "com.mycompany.myproduct"
multiDexEnabled true
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
// signingConfigs {
// release {
// keyAlias keystoreProperties['keyAlias']
// keyPassword keystoreProperties['keyPassword']
// storeFile file(keystoreProperties['storeFile'])
// storePassword keystoreProperties['storePassword']
// }
// }
// buildTypes {
// release {
// signingConfig signingConfigs.release
// minifyEnabled true
// useProguard true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// }
// }
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
}
}
}
flutter {
source '../..'
}
dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
最佳答案
一定是某个地方的顶部空间错误,但我完全删除并重新安装了除 Windows 之外的所有内容,并且重新开始营业。我讨厌不知道这是横向的...
关于android - flutter build apk --debug 在没有发布 keystore 的情况下无法构建调试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58735111/