Menu

Flutter gradle error after flutter run

6th November 2018 - flutter, mobile, Uncategorised

If you get a;

Could not find lint-gradle-api.jar

error, then the easiest way to fix it is to go to your flutter SDK folder, then packages\flutter_tools\gradle and open up the flutter.gradle file in a text editor.

Finally, in the buildscript.repositories node of the json near the top of the page, swap the maven node around and place it above the jcenter() entry.
e.g. The original file looks like this:


buildscript {
    repositories {
        jcenter()
      maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}

change to


buildscript {
buildscript {
    repositories {
      maven {
            url 'https://dl.google.com/dl/android/maven2'
        }
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
    }
}

Take care!