Failed to resolve: com.android.support:appcompat-v7:26.0.0

后端 未结 14 1539
旧时难觅i
旧时难觅i 2020-11-22 05:56

I am having this issue in Android studio.

Error:(22, 13) Failed to resolve: com.android.support:appcompat-v7:26.0.0
Install         


        
14条回答
  •  隐瞒了意图╮
    2020-11-22 06:26

    Please be noted, we need to add google maven to use support library starting from revision 25.4.0. As in the release note says:

    Important: The support libraries are now available through Google's Maven repository. You do not need to download the support repository from the SDK Manager. For more information, see Support Library Setup.

    Read more at Support Library Setup.

    Play services and Firebase dependencies since version 11.2.0 are also need google maven. Read Some Updates to Apps Using Google Play services and Google APIs Android August 2017 - version 11.2.0 Release note.

    So you need to add the google maven to your root build.gradle like this:

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    

    For Gradle build tools plugin version 3.0.0, you can use google() repository (more at Migrate to Android Plugin for Gradle 3.0.0):

    allprojects {
        repositories {
            jcenter()
            google()
        }
    }
    

    UPDATE:

    From Google's Maven repository:

    The most recent versions of the following Android libraries are available from Google's Maven repository:

    • Android Support Library
    • Architecture Components Library
    • Constraint Layout Library
    • Android Test Support Library
    • Databinding Library
    • Android Instant App Library
    • Google Play services
    • Firebase

    To add them to your build, you need to first include Google's Maven repository in your top-level / root build.gradle file:

    allprojects {
        repositories {
            google()
    
            // If you're using a version of Gradle lower than 4.1, you must instead use:
            // maven {
            //     url 'https://maven.google.com'
            // }
            // An alternative URL is 'https://dl.google.com/dl/android/maven2/'
        }
    }
    

    Then add the desired library to your module's dependencies block. For example, the appcompat library looks like this:

    dependencies {
        compile 'com.android.support:appcompat-v7:26.1.0'
    }
    

    However, if you're trying to use an older version of the above libraries and your dependency fails, then it's not available in the Maven repository and you must instead get the library from the offline repository.

提交回复
热议问题