* What went wrong:
A problem occurred configuring project ':app'.
> Could not find support-annotations.jar (com.android.support:support-annotations:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.jar
发生的问题有点怪
- 大家从一个分支上拉的代码,其他人都没有问题,而我的却有问题;
- 之前我打包也没有报这个错误,一天不知道怎么操作了一下就找不到了;
- 本地可以找到support-annotaions 26.1.0的 资源,但系统还是报错
思考:
出现找不到jar 包的问题,可能有几个原因:
- androidstudio 可能gradle 插件更新或者那个版本更新,可能会出现问题;
- maven 库 或者jcenter 库里面找不到资源;
- androidstudio 有问题,重新安装AS;
尝试:
- 对整个项目 rebuild 之后,gradle使用 非 offline 模式 ,看能否正常运行 ; 答案否
- 使用其他的资源配置,看能否找到 该资源,在 根目录 build.gradle 中 allproject 中配置资源引用仓库配置
使用了 阿里的 maven { url 'https://maven.aliyun.com/repository/google' }
maven{ url 'https://maven.aliyun.com/repository/jcenter'},谷歌的 maven { url "https://dl.google.com/dl/android/maven2/" } ,都不好使,后来使用 jcenter 进行修饰jcenter(){url"http://jcenter.bintray.com/"} 不报那个错了,可以正常编译了。
小结:
原因可能是 https 找不到资源,而 http 能找到资源,可是我直接将https 改为 http 后网络上还是没有找到资源报404 错误。
网友评论