Could not find support-media-compat.aar

升级android studio到3.3版本,今天checkout到历史tag上运行android项目,死活报错

  • 之前也有同事遇到过类似的问题

Could not find support-media-compat.aar

最后意外发现是google()仓库位置的问题
报错配置:

allprojects {
    repositories {
        flatDir {
            dirs 'libs'
        }
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://dl.bintray.com/thelasterstar/maven/" }
        maven {
            url "http://maven.aliyun.com/nexus/content/repositories/releases"
        }
        mavenCentral()
        google()
    }
    configurations.all {
        resolutionStrategy {
            force "com.android.support:appcompat-v7:$supportLibVersion"
        }
    }
}

把google()放到第一位即可

allprojects {
    repositories {
        google()
        flatDir {
            dirs 'libs'
        }
        jcenter()
        maven { url "https://jitpack.io" }
        maven { url "https://dl.bintray.com/thelasterstar/maven/" }
        maven {
            url "http://maven.aliyun.com/nexus/content/repositories/releases"
        }
        mavenCentral()
    }
    configurations.all {
        resolutionStrategy {
            force "com.android.support:appcompat-v7:$supportLibVersion"
        }
    }
}
    原文作者:gsyQAQ
    原文地址: https://www.jianshu.com/p/40025f491f12
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞