Couldn’t locate lint-gradle-api-26.1.2.jar for Flutter project

Hello Guys how are you all ? Hope You all are fine. When I am trying to run the example project, I have this issue:

FAILURE: Build failed with an exception

Could not resolve all files for configuration ‘classpath’. Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

What is cause Couldn’t locate lint-gradle-api-26.1.2.jar for Flutter project

it’s trying to get the file “lint-gradle-api-26.1.2.jar” from the jcenter repository but it Could not find resource. and through this below error.

Could not resolve all files for configuration ‘classpath’. Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2). Searched in the following locations: https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar

Solutions

Question: How To Solve Couldn’t locate Lint-gradle-api-26.1.2.jar for flutter project?
Answer : To solve this error You have to make change in flutter.gradle file.

Solution 1 : update flutter.gradle file.

I solved the problem by moving:

maven {
    url 'https://dl.google.com/dl/android/maven2'
}

in the top of:

jcenter()

in the file: .flutter/packages/flutter_tools/gradle/flutter.gradle:

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

Solution 2 : Modify flutter.gradle

Modify flutter.gradle under ./flutter/packages/flutter_tools/gradle to upgrade the tools version to 3.2.1 and add google() to the first line:

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

Solution 3 : changed this line in the build.gradle file

Regarding this error, I just changed this line in the build.gradle file:

classpath 'com.android.tools.build:gradle:3.1.2'

to:

classpath 'com.android.tools.build:gradle:3.1.3'

And that solved my problem.

Solution 4 : flutter upgrade

This is related to Flutter 0.9.4 at the moment. It will be fixed in the next release. In the meantime, you can update Flutter manually by running the commands described in “Flutter Upgrade”. Basically they involve the following:

  1. Change the Flutter GitHub channel to master by running on the command prompt:flutter channel master
  2. Upgrade Flutter itself by runningflutter upgrade

Once the upgrade is done, run the test drive application, and it should compile successfully.

So Hope This Above 3 Solution Will Work For You Too. So it’s all About Couldn’t locate lint-gradle-api-26.1.2.jar for Flutter project error. Hope this tutorial helped you a lot. Comment below Your thoughts and your queries. And Also Comment on your suggestion here.

Also Read

Milan Dhameliya is an Information Technology Engineer. By profession, he is a Full Stack developer with knowledge of multiple back-end platforms (e.g., PHP, Node.js, Python) and frontend Flutter frameworks.

Leave a Comment