【问题标题】:What could be the cause of this error. Execution failed for task ':app:compileFlutterBuildRelease'这个错误的原因可能是什么。任务“:app:compileFlutterBuildRelease”执行失败
【发布时间】: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'

【问题讨论】:

    标签: flutter dart


    【解决方案1】:

    首先,请确保您已正确跟进此documentation 中的所有程序,然后在您确定您已正确跟进之后

    试试这个:

    flutter clean

    flutter build apk --debug

    flutter build apk --profile

    flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi

    建议: 如果这没有帮助,那么添加您得到的完整错误以及两个完整的 Gradle 文件 而不是拆分 apk 使用 app bundle,供 app bundle 使用:

    flutter build appbundle

    如果这有帮助,请在 cmets 中通知

    【讨论】:

    • 感谢贾加迪什
    • 欢迎...@ClintonSang...如果有帮助请点赞
    猜你喜欢
    • 1970-01-01
    • 2021-06-19
    • 2012-02-24
    • 1970-01-01
    • 2019-06-29
    • 1970-01-01
    • 2020-10-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多