AndroidStudio报错:Could not get resource ‘xxx/xxx/error_prone_annotations-2.2.0.jar‘

自认为自己已经算是老鸟了,在使用Android Studio build的时候也总会遇到奇怪的问题,

例如:今天mac电脑在运行安卓项目时,遇到了这个问题:

 
FAILURE: Build failed with an exception.
 
* What went wrong:
Execution failed for task ':app:javaPreCompileDebug'.
> Could not resolve all files for configuration ':app:debugAnnotationProcessorClasspath'.
   > Could not download error_prone_annotations.jar (com.google.errorprone:error_prone_annotations:2.2.0)
            > jcenter.bintray.com: nodename nor servname provided, or not known
 
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
 
* Get more help at https://help.gradle.org
 
BUILD FAILED in 7s
26 actionable tasks: 22 executed, 4 up-to-date
 
 

解决方式:

在 gradle.properties 文件中加入如下配置:

systemProp.https.nonProxyHosts=localhost
#systemProp.https.proxyPort=1080
systemProp.http.proxyHost=127.0.0.1
systemProp.http.nonProxyHosts=localhost
#systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080

参考博文:

解决Could not get resource 'https://dl.google.com

猜你喜欢

转载自blog.csdn.net/YuDBL/article/details/107462166