我创建了一个新项目,但是当它完成第一次编译时,新项目返回一个错误:
Error:Could not find common.jar (android.arch.core:common:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar
我真的不知道如何解决它,希望你能帮助我!
我如何创建新项目的屏幕截图:
Build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
setting.gradle
include ':app'
我添加了 gradle 文件,因为我认为那里有问题。
最佳答案
在 jcenter()
之前添加 maven { url 'https://maven.google.com' }
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
}
它会起作用的
更新:
注意:google()
和 maven { url 'https://maven.google.com' }
指向同一个repo,google()
是 Google 的 Maven repo 快捷方式。您可以添加 google()
而不是 maven { url 'https://maven.google.com' }
如果您正在使用:
Gradle >= v.4.x+
Android Studio >= 3.x+
Gradle plugin for Android >= 3.x+
关于android - 找不到 common.jar (android.arch.core :common:1. 1.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50570134/