A problem occurred configuring root project 'android' Flutter Failed to create jar file

868 Views Asked by At

I have this error can you tell me what's the solution for it?

Launching lib\main.dart on SM A325F in debug mode... FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'android'.

java.util.concurrent.ExecutionException: org.gradle.api.GradleException: Failed to create Jar file C:\Users\Hamza Traders.gradle\caches\jars-9\77f1b6119df996df354847f2f9be857a\gradle-7.1.2.jar.

  • 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.

BUILD FAILED in 14s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)

What i tried:

1- flutter clean and flutter pub get 2- created a new project still got the same issue 3- run the flutter project on different IDEs (Android Studio/ VsCode) 4- My build.gradle

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
        jcenter()
    }

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

allprojects {
    repositories {
        google()
        mavenCentral()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1

There are 1 best solutions below

0
On

I would recommend you to close VS Code / Android Studio, open the task manager and force to stop/kill all Java processes. Then clear the Cache folder at C:\Users\YourUserName\.gradle\caches