[SOLVED] build.gradle error: Could not create tastk ‘:generateLockfiles’. in Flutter project but App is running normal

Question

This Content is from Stack Overflow. Question asked by OverdoseB12

I have an error in my build.gradle file (android/build.gradle) in my Flutter project. The App is running completely normal but this error is still not looking good to me.
Does anyone ever had this problem/error?

enter image description here

enter image description here

Here is my complete build.gradle file:

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

    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.3.13'
    }
}

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

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

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

Solution

You can do flutter clean and flutter pub get and then try to build again.

Answered by Hardik Mehta


This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 4.0.

people found this article helpful. What about you?