Android Studio一直拒绝解析com.android.support:appcompat-v7:29.0.1

use*_*934 5 android android-appcompat android-support-library android-gradle-plugin androidx

我已经提到了这个线程,但是它不能解决我的问题。

我不断收到错误消息: ERROR: Failed to resolve: com.android.support:appcompat-v7:29.0.1 每次尝试刷新Gradle时,在Android Studio中。

这是我的 build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "com.application.app"
        minSdkVersion 14
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:29.0.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)

我该如何解决?还有一个网站列出了所有android模块的所有版本?我自己找不到任何人。

谢谢。

Gab*_*tti 9

之所以发生是因为com.android.support:appcompat-v7:29.x.x 不存在

您可以在官方文档中查看修订历史记录

您可以:

  • 使用支持库的最新28.0.0版本
  • 迁移到androidx

另请检查此注释

注意:随着Android 9.0(API级别28)的发布,Jetpack包含了一个新版本的支持库AndroidX。AndroidX库包含现有的支持库,还包含最新的Jetpack组件。

您可以继续使用支持库。历史工件(那些版本为27和更低版本,并打包为android.support。*的工件)将在Google Maven上可用。但是,所有新的库开发都将在AndroidX库中进行。

我们建议在所有新项目中使用AndroidX库。您还应该考虑将现有项目迁移到AndroidX。


小智 5

替换 implementation 'com.android.support:appcompat-v7:29.0.1' implementation 'androidx.appcompat:appcompat:1.0.2'