Could not find support-annotatio

作者: 代码君_Coder | 来源:发表于2019-04-02 11:41 被阅读9次

今天编译项目遇到一个报错,如下:

ERROR: Could not find support-annotations.jar (com.android.support:support-annotations:27.0.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-annotations/27.0.2/support-annotations-27.0.2.jar
Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

image.png

错误原因是找不到support-annotations 27.0.2 的这个库,我打开连接,确实没有


image.png

解决方案

在项目的build.gradle repositories里面加入下面代码,
maven { url "https://maven.google.com"}

其实应该就是jcenter仓库里面没有该资源,我们用Google中的Maven仓库里下载就有了,所以问题就迎刃而解,记录下来,给别人作为参考

allprojects {
    repositories {

        //需要添加的部分
        maven { url "https://maven.google.com"}

        maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
        jcenter()
        maven { url 'https://jitpack.io' }
        mavenCentral()
        flatDir {
            dirs 'libs'
        }
    }
}

公众号

相关文章

网友评论

    本文标题:Could not find support-annotatio

    本文链接:https://www.haomeiwen.com/subject/jrbwbqtx.html