问题
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".
回答1:
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
回答2:
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()
}
}
回答3:
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'
}
}
回答4:
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.
回答5:
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>
回答6:
add below code to your build.gradle (Module) to skip error
lintOptions {
abortOnError false
}
回答7:
Try this,
File -> Settings -> Build,Execution,Deployment -> Gradle -> Android Studio -> Select -Enable embedded maven repository - Apply.
来源:https://stackoverflow.com/questions/46972122/could-not-find-com-android-tools-lintlint-gradle-android-studio-3