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 {

    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 {

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"

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

flutter doctor -v Output:

[√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.22598.200], locale de-DE)
    • Flutter version 3.0.5 at C:\Flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f1875d570e (5 weeks ago), 2022-07-13 11:24:16 -0700
    • Engine revision e85ea0e79c
    • Dart version 2.17.6
    • DevTools version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\jjkla\AppData\Local\Android\sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 2020.3)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
    • Dart plugin can be installed from:
    • Java version OpenJDK Runtime Environment (build 11.0.10+0-b96-7249189)

[√] VS Code (version 1.70.1)
    • VS Code at C:\Users\jjkla\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 104.0.5112.81
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 104.0.1293.54

[√] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Solution 1: Mostafa Pirhayati

open your android project in android studio file > open > in your flutter project choose android file then rebuild gradle, I have same problem and solved it like this.

Solution 2: Hardik Mehta

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

Solution 3: Ivan Tsaryk

You can try to rebuild the build.gradle file.
Just follow these steps.

cd android 
./gradlew clean  
./gradlew build

You can also execute this command in one line.

./gradlew clean build

Solution 4: Pablo Diego

Same problem here, but in Linux and Visual Studio code.

With ./gradlew in android directory, the build failed due wrong Java version. Was Java 1.8, but must be at least 11. After that, ./gradlew built successfully.

After restart visual studio code, the error was gone.