Could not find com.android.tools.lint:lint-gradle Android Studio 3
AndroidAndroid StudioLintAndroid Studio-3.0Android Problem Overview
I have updated Android Studio to 3.0 and now received a lot of issues.. now stoped on point with such issue:
Could not resolve all files for configuration ':applib:_lintClassPath'.
> Could not find com.android.tools.lint:lint-gradle:26.1.0-alpha01.
Searched in the following locations:
file:/Users/anwender/Library/Android/sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
file:/Users/anwender/Library/Android/sdk/extras/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
file:/Users/anwender/Library/Android/sdk/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
file:/Users/anwender/Library/Android/sdk/extras/google/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
file:/Users/anwender/Library/Android/sdk/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
file:/Users/anwender/Library/Android/sdk/extras/android/m2repository/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
https://jitpack.io/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.pom
https://jitpack.io/com/android/tools/lint/lint-gradle/26.1.0-alpha01/lint-gradle-26.1.0-alpha01.jar
file:/Users/anwender/dev/project/dk_shopping_checklist/augmented/libs/lint-gradle-26.1.0-alpha01.jar
file:/Users/anwender/dev/project/dk_shopping_checklist/augmented/libs/lint-gradle.jar
Required by:
project :applib
Does someone know what the issue can be?
Gradle.build:
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
minSdkVersion 24
targetSdkVersion 26
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:+'
}
I'm using latest gradle version: "gradle-4.2.1-all.zip".
Android Solutions
Solution 1 - Android
If you're running lint on a project that you created using an older version of Android Studio, you may encounter this error.
To resolve this issue, for each project that you would like to run lint on, include Google's Maven repository in the top-level build.gradle
file, as shown below:
allprojects {
repositories {
// The order in which you list these repositories matter.
google()
jcenter()
}
}
Solution 2 - Android
It looks to me like you're missing the google()
repository in order to fetch the dependency.
Here's the link to the pom file that you're looking for: https://dl.google.com/dl/android/maven2/com/android/tools/testutils/26.1.0-alpha01/testutils-26.1.0-alpha01.pom
Solution 3 - Android
My answer is for everyone that Already have google()
in repositories but still have same error
- goto android studio settings and search for "HTTP Proxy" and make sure you haven't set a wrong proxy there. (set it to auto-detect proxy settings if not sure)
- close android studio
- goto C:/Users/DESKTOP-NAME/ and Delete .gradle folder (yes, it's big folder but don't be scared its just keeping all versions of your old gradle files that is not needed now)
- goto you project folder and delete .gradle folder and app/build folder (make a backup before this just in case)
- restart your PROXY server Or VPN provider (if you use one) and make sure you have a working internet connection.
- Open Android Studio and wait until successful build (it's gonna take a little longer).
Solution 4 - Android
I solved this by adding the https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api
repo to build.gradle
:
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
maven {
url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api'
}
}
Solution 5 - Android
I have changed my current gradle version(3.3.2 to 3.2.1) from the global build.gradle file.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
}
then click on sync gradle button on the top right corner of the screen.
Solution 6 - Android
Try this,
File -> Settings -> Build,Execution,Deployment -> Gradle -> Android Studio -> Select -Enable embedded maven repository - Apply.
Solution 7 - Android
Another option is
./gradlew -x:app:lintVitalRelease assemble
To quote Gradle Docs:
Excluding tasks from execution
You can exclude a task from being executed using the -x or --exclude-task command-line option and providing the name of the task to exclude.
Archived link: http://archive.is/TsPPJ#sec:excluding_tasks_from_the_command_line
Solution 8 - Android
just comment google and sync project
repositories {
google()
jcenter()
}
Disable offline mode and uncomment google() and sync again...
Solution 9 - Android
Add google() to your gradle If you face this again,Do not add a linter disabler to your gradle, This is an access error issue,I faced that on react-native after using sudo command for a few command, Just reset your code access and then release again For example the mac
sudo chmod -R 777 <project-root-folder-name>
Solution 10 - Android
add below code to your build.gradle (Module) to skip error
lintOptions {
abortOnError false
}
Solution 11 - Android
My has this issue, solved by below lines
buildscript {
ext.kotlin_version = '1.3.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1' //3.4.2, 3.4.1^, 2.3.3^
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.google.gms:google-services:4.3.3'
}
}
//################################################################################
allprojects {
repositories
{
google()
jcenter()
mavenCentral()
maven { url "https://dl.google.com/dl/android/maven2/" }
maven { url "http://jcenter.bintray.com/" }
maven { url 'https://plugins.gradle.org/m2/'}
maven { url "https://maven.google.com" }
maven { url 'https://jitpack.io' }
maven { url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api' }
flatDir {
dirs 'libs'
}
}
}
//################################################################################
task clean(type: Delete) {
delete rootProject.buildDir
}
Solution 12 - Android
im my case I solved the problem by downgrading gradle version from 3.6.3:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
to 3.4.2:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Solution 13 - Android
Do not comment out google(), while applying the solutions above:
repositories {
maven {
url 'https://maven.google.com/'
name 'Google'
}
jcenter()
google()
maven {
url 'https://mvnrepository.com/artifact/com.android.tools.lint/lint-gradle-api'
}
}
Solution 14 - Android
To solve dependencies issues it's always helpful to use
./gradlew clean build --refresh-dependencies
In my case I got the next message:
- Variant 'runtimeElements' capability com.android.tools.lint:lint-api:30.0.2 declares a runtime of a library, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'jvm':
- Incompatible because this component declares a component compatible with Java 8 and the consumer needed a component compatible with Java 7
- Other compatible attribute:
- Doesn't say anything about its target Java environment (preferred optimized for standard JVMs)
So, my problem with this dependency was that I was using:
java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
}
and this particular dependency requires JavaVersion.VERSION_1_8 instead. When I replaced it by
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
it started working.