当我创建一个新项目时,我将这些依赖项作为默认:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
同步项目一开始就失败了,我无法修复它。错误是针对
'androidx.appcompat:appcompat:1.1.0'
gradle 无法解决这种依赖关系。错误日志:
ERROR: Failed to resolve: appcompat
Affected Modules: app
Gradle 模块项目:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我检查了下载 URL,结果是 404:https://dl.google.com/dl/android/maven2/androidx/appcompat/appcompat/1.1.0
知道如何解决吗?
最佳答案
试试这个:-
实现 'androidx.appcompat:appcompat:1.1.0'
实现“androidx.core:core-ktx:1.1.0”
关于AndroidX 错误 : Failed to resolve: appcompat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58730169/