AndroidX 错误 : Failed to resolve: appcompat

标签 android gradle android-appcompat androidx

当我创建一个新项目时,我将这些依赖项作为默认:

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/

相关文章:

android - 为什么我收到执行错误 `Could not find property` bootClasspath

java - 尝试使用此语言级别不支持的资源

android - 找不到 com.android.support :design-23. 2.1 和找不到 com.android.support.appcompat-v7-23.2.1 错误

android - 在Android中使用GoogleHeaders时要包括哪些内容?

android - 将 SearchView 与 AppCompatActivity 一起使用会导致 UI 故障

android - AppCompatActivity 相对于 ActionBarActivity 的增强是什么?

android - 我该如何编写这个 Android 应用程序?自动改变音频输出模式

Android:在 TextChangedListener 中获取 EditText 的父 View

单击时android更改按钮图标

android - 想要在 Android 中的适当应用程序中打开下载的文件