top of page
Search

How to Fix "Cannot Build Android APK Flutter" Issue: A Comprehensive Guide

  • Writer: Aarthi Krishnan
    Aarthi Krishnan
  • Feb 8, 2024
  • 1 min read

Cannont Build Android APK Flutter
Cannot Build Android APK Flutter

Hey guys it's me, Aarthi Krishnan. I'm a flutter developer, recently I have faced an error while building apk in flutter android studio (cannot build an android apk flutter) and Unable to build apk in android studio



Flutter build apk failed

Let's see how to get rid of can not build android apk flutter

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\Flutter\arthi_flutter\build\app\intermediates\flutter\debug\libs.jar. Failed to transform 'E:\AndroidStudioProjects\FlutterProject\Flutter\arthi_flutter\build\app\intermediates\flutter\debug\libs.jar' using Jetifier. Reason: FileNotFoundException, message: E:\AndroidStudioProjects\FlutterProject\Flutter\arthi_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.

BUILD FAILED in 1m 8s


The solution that I tried worked for me. Let's see how to get rid of ( Can not build android apk flutter )


We have to downgrade the gradle.build from


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


To change like below:



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

and also go to gradle-warpper.properties. In there you have to change 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


Change like below:



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


This is the solution I tried for can not build android apk flutter error. I hope it will help you guys. and also check your android studio version. Keep your android studio up to date.

Happy Coding :)


Aarthi Krishnan❤️

Comments


bottom of page