Failed to resolve com.android.support:support-annotations 26.0.1

后端 未结 3 1439
我在风中等你
我在风中等你 2020-12-03 03:03
dependencies {
    compile fileTree(dir: \'libs\', include: [\'*.jar\'])
    androidTestCompile(\'com.android.support.test.espresso:espresso-core:2.2.2\', {
                 


        
相关标签:
3条回答
  • 2020-12-03 03:21

    All current editions of Google libraries reside in Google's Maven repository (maven.google.com), not in the old offline-capable support repositories.

    In your project-level build.gradle file, make sure that your allprojects closure looks like this:

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

    or, on Android Studio 3.0+, like this:

    allprojects {
        repositories {
            jcenter()
            google()
        }
    }
    
    0 讨论(0)
  • 2020-12-03 03:40

    I resolved this issue by adding the below in project level build.gradle file.

    buildscript {
    
        repositories {
            jcenter()
            google()
    
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.1.2'
    
    
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
           jcenter()
           maven {
                 url 'https://maven.google.com'
              }
        }
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    
    0 讨论(0)
  • 2020-12-03 03:45

    Even with Android Studio 3.0.+, I had to add this below (not just google() like @CommonsWare recommended), to get pass the error

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

    }

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