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

后端 未结 14 1571
旧时难觅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:18

    If you are using Android Studio 3.0, add the Google maven repository as shown below:

    allprojects {
      repositories {
        jcenter()
        google()
     }
    }
    
    0 讨论(0)
  • 2020-11-22 06:22

    Go to SDK path: SDK\extras\android\m2repository\com\android\support\appcompat-v7 to see correct dependency name, then change name if your dependency is alpha version:

    dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:26.0.0'
    }
    

    to :

    dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    }
    
    0 讨论(0)
  • 2020-11-22 06:25

    File -> Project Structure -> Modules (app) -> Open Dependencies Tab -> Remove all then use + to add from the proposed list.

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2020-11-22 06:26

    you forgot to add add alpha1 in module area

    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    

    use maven repository in project area that's it

    allprojects {
        repositories {
            jcenter()
            maven {
                url "https://maven.google.com"
            }
        }
    }
    
    0 讨论(0)
  • 2020-11-22 06:26

    I was facing the same issue but I switched 26.0.0-beta1 dependencies to 26.1.0 and it's working now.

    0 讨论(0)
提交回复
热议问题