flutter: can not build android apk

前端 未结 9 2405
心在旅途
心在旅途 2020-12-16 18:35
FAILURE: Build failed with an exception.
  • What went wrong: Execution failed for task \':app:lintVitalRelease\'.

    Coul

相关标签:
9条回答
  • 2020-12-16 19:27

    try running flutter clean on the project folder and then trying again. it seems a file got missing from the build folder

    0 讨论(0)
  • 2020-12-16 19:27

    In android build.gradle,

    dependencies {
       classpath 'com.android.tools.build:gradle:3.5.0'
    }
    

    didn't work for me and throwed cloud firestore error while executing flutter run. So I changed my gradle version to 4.0.1. where flutter run executed successfully, but flutter build apk fails, so I changed its version to 3.5.4.

    In android/gradle/wrapper/gradle-wrapper.properties set,

    distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
    

    which works perfectly for both flutter run and flutter build apk. In future this gradle version may not support few plugins that we use in our project, in that case upgrade to the next gradle version. refer gradle versions here: How Do I Fix "unexpected element <queries> found in <manifest>"?

    0 讨论(0)
  • 2020-12-16 19:30

    I found the workaround I needed for my case, I believe it will work for you as well.

    I've set the checkReleaseBuilds flag to false in the android's app-level build.gradle like so:

    android {
        ...
        lintOptions {
            checkReleaseBuilds false
        }
    }
    

    Found it here

    0 讨论(0)
提交回复
热议问题