Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter: can not build android apk

FAILURE: Build failed with an exception.
  • What went wrong: Execution failed for task ':app:lintVitalRelease'.

    Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'. Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. Execution failed for JetifyTransform: E:\AndroidStudioProjects\FlutterProject\EduyaariGuruFlutter\eduyaari_guru_flutter\build\app\intermediates\flutter\debug\libs.jar. Failed to transform 'E:\AndroidStudioProjects\FlutterProject\EduyaariGuruFlutter\eduyaari_guru_flutter\build\app\intermediates\flutter\debug\libs.jar' using Jetifier. Reason: FileNotFoundException, message: E:\AndroidStudioProjects\FlutterProject\EduyaariGuruFlutter\eduyaari_guru_flutter\build\app\intermediates\flutter\debug\libs.jar (The system cannot find the path specified). (Run with --stacktrace for more details.) Please file a bug at http://issuetracker.google.com/issues/new?component=460323.

  • 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 1m 8s

like image 349
Karishma Patel Avatar asked Jun 15 '20 17:06

Karishma Patel


3 Answers

Step 1. flutter build apk --debug

Step 2. flutter build apk --profile

Step 3. flutter build apk --release

like image 141
Subair K Avatar answered Dec 23 '22 19:12

Subair K


The only solution that worked for me was downgrading the gradle.build from

dependencies {
    classpath 'com.android.tools.build:gradle:4.0.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

to

 dependencies {
    classpath 'com.android.tools.build:gradle:3.5.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}

and changed the gradle-warpper.properties from

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

to

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip

Here you can see why you should not just add lintOptions { checkReleaseBuilds false } on the gradle.

like image 36
Elias Meireles Avatar answered Dec 23 '22 19:12

Elias Meireles


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

like image 23
dasfima Avatar answered Dec 23 '22 17:12

dasfima