Could not find support-annotatio
2019-04-02 本文已影响9人
代码君_Coder
今天编译项目遇到一个报错,如下:
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

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

解决方案
在项目的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'
}
}
}
公众号
