Failed to resolve: support-compat

  • 在网上下载了一个android开源app,用Android studio打开后编译时遇到下面的错误
Failed to resolve: support-compat
  • project gradle script
// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply from: "dependencies.gradle"

buildscript {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com' }
        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://jitpack.io' }
        maven { url 'https://maven.google.com' }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
  • 最终发现是classpath中的gradle版本不对,改成和本地其他项目一致的版本就对了
classpath 'com.android.tools.build:gradle:3.2.1'

你可能感兴趣的:(Failed to resolve: support-compat)