Couldn't locate lint-gradle-api-26.1.2.jar for Flutter project
Solution 1
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
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
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
This is just a bug in the Gradle file located at C:\flutter\packages\flutter_tools\gradle\flutter.gradle
at line 25.
All you have to do is just edit this file by moving it to the top:
maven {
url 'https://dl.google.com/dl/android/maven2'
}
Change from this
buildscript {
repositories {
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
to this:
buildscript {
repositories {
maven {
url 'https://dl.google.com/dl/android/maven2'
}
jcenter()
}
dependencies {`enter code here`
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
Solution 5
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:
Change the Flutter GitHub channel to master by running on the command prompt:
flutter channel master
Upgrade Flutter itself by running
flutter upgrade
Once the upgrade is done, run the test drive application, and it should compile successfully.
Hyerois
Hyerois π I'm a french college student, currently doing a Two Year technical degree in chartered accounting. πΊπΈ Β I'm trying to become a fluent english speaker. π» I love computing since my childhood and started programming when I was fourteen. I love : Golang ; ReactJS ; R ; working with statistics. π Nice, France French editor for Genius.
Updated on July 08, 2022Comments
-
Hyerois almost 2 years
I'm new to Flutter and trying to run the example project when you create a new one. When trying to run it, I have this issue:
FAILURE: Build failed with an exception.
Where: Build file 'PROJECTPATH/android/app/build.gradle' line: 25
-
What went wrong: A problem occurred evaluating project ':app'.
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
I understand it's trying to get the file "lint-gradle-api-26.1.2.jar" from the jcenter repository but when following the link I get this:
{ "errors" : [ { "status" : 404, "message" : "Could not find resource" } ] }
So I added the Google repository in my
build.gradle
file:buildscript { repositories { maven { url 'https://dl.google.com/' } google() jcenter() }
...and I also succeed to get the file by following this link:
...but I'm still getting the same error when trying to run my project, whether it is by using Visual Studio Code, Android Studio or with the CLI.
How do I force Gradle to download the file from the link I've found?
Here's how my
build.gradle
file looks like:buildscript { repositories { //maven { url 'https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar' } repositories { google() maven { url 'https://maven.fabric.io/public' } mavenCentral() jcenter() } } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' } } allprojects { repositories { google() maven { url 'https://maven.fabric.io/public' } mavenCentral() jcenter() } } repositories { google() maven { url 'https://maven.fabric.io/public' } mavenCentral() jcenter() } ....
-
HedeH over 5 yearsMaybe this will help: stackoverflow.com/a/52944600/4255978
-
Hyerois over 5 yearsIt didn't, still getting the same error
-
absin over 5 yearsFor people coming here now, I think this has been fixed in master, so
flutter channel master
andflutter upgrade
should sove it.
-
mano233 over 5 yearsUpgrade your flutterοΌ This is my environmental information and I am working now. [β] Flutter (Channel beta, v0.9.4, on Microsoft Windows [Version 10.0.17763.104], locale zh-CN) [β] Android toolchain - develop for Android devices (Android SDK 28.0.3) [β] Android Studio (version 3.2) [β] Connected device (1 available)
-
mano233 over 5 yearsUpgrade distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
-
Gayan Pathirage over 5 yearsThank you loads @Quentin. You saved me after 3 hours of trying various things. Gradle error seems like some dependency issue with a missing package.
-
Gaurav Sharma over 5 yearsSaved me. I was facing the same issue
-
Carles over 5 yearsSaved as well. Thanks a bunch
-
Kevin Robatel over 5 yearsBy the way,
.flutter
isC:\flutter
on Windows (or the location of Flutter installation). It's not linked to a project. -
cesards over 5 yearsYou don't actually need to update the project dependencies repositories, so this answer is the one! :-D
-
martinseal1987 over 5 yearsdid not see this working but definitely worked for me
-
vijju over 5 yearsHII Aegon. I didn't find any flutter SDK. Where to find it. I have the same error?
-
Aegon over 5 yearsYou have to download the SDK first, here is a doc explains installation. flutter.io/docs/get-started/install
-
AloDev over 5 yearsIt is strange, but downgrading the gradle from 3.1.2 to 3.0.1(in my case) helped me.
-
Shamshun about 5 yearsActually, changing Gradle plugin version from "3.2.1" to "3.1.2" worked for me! What's going on here?
-
mohammad.pro about 4 yearsI am struggling with this for a week and it didn't work for me, any ideas? and I have to mention that I am using a VPN because I live in a country blocked by google
-
mohammad.pro about 4 yearsbut if I click on the URL it downloads the file in the browser so actually I have the access, Can I use these files and where should I but them
-
Sajjad over 2 yearsThank you . so much . πππ.