【发布时间】:2021-03-20 02:19:31
【问题描述】:
我尝试为 Flutter 生成构建版本,但出现了这些错误。任务 ':app:compileFlutterBuildRelease' 执行失败。我用于生成构建的代码是flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi。调试完美。
android {
compileSdkVersion 29
buildToolsVersion 29
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.abc.def"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
}
}
我用于生成构建的代码是flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi。调试工作完美。 // 这是我更新的主要部分
// 获取要构建的发布 APK
构建类型 {
发布 {
// TODO:为发布构建添加您自己的签名配置。
// 现在使用调试密钥签名,所以flutter run --release 有效。
签名配置签名配置.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation platform('com.google.firebase:firebase-bom:25.12.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-functions:19.0.2'
implementation 'com.google.firebase:firebase-messaging:20.2.0'
implementation 'com.google.firebase:firebase-database:19.3.0'
implementation 'com.google.firebase:firebase-core:17.4.3'
implementation 'com.google.code.gson:gson:2.8.6'
}
apply plugin: 'com.google.gms.google-services'
【问题讨论】: