今天在Android studio运行项目的时候报了如下错误,项目都编译不过了,顿时慌。。。

这里附上gradle额下载地址(gradle)

Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not resolve com.tencent.bugly:nativecrashreport:latest.release.
  Required by:
      project :app
   > Could not resolve com.tencent.bugly:nativecrashreport:latest.release.
      > Failed to list versions for com.tencent.bugly:nativecrashreport.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/tencent/bugly/nativecrashreport/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/com/tencent/bugly/nativecrashreport/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
   > Could not resolve com.tencent.bugly:nativecrashreport:latest.release.
      > Failed to list versions for com.tencent.bugly:nativecrashreport.
         > Unable to load Maven meta-data from https://dl.bintray.com/jetbrains/anko/com/tencent/bugly/nativecrashreport/maven-metadata.xml.
            > Could not get resource 'https://dl.bintray.com/jetbrains/anko/com/tencent/bugly/nativecrashreport/maven-metadata.xml'.
               > Could not GET 'https://dl.bintray.com/jetbrains/anko/com/tencent/bugly/nativecrashreport/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

直接访问错误信息中的地址,

 直接访问错误信息中的地址,502错误,如下

咨询了一下万能的群友(好多群都有这个问题),得到如下解决方案,照做之后就ok:

 注释掉jcenter,替换成maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }

allprojects {
    repositories {
        google()
//        jcenter()
//        maven {url 'https://dl.bintray.com/jetbrains/anko'} 
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }//解决以下下问题(jcenter bad gateway 502)

//        Error:Could not resolve all files for configuration ':app:debugCompileClasspath'.
//                > Could not resolve com.tencent.bugly:nativecrashreport:latest.release.
//                Required by:
//                project :app
//        > Could not resolve com.tencent.bugly:nativecrashreport:latest.release.
//                > Failed to list versions for com.tencent.bugly:nativecrashreport.
//                > Unable to load Maven meta-data from https://jcenter.bintray.com/com/tencent/bugly/nativecrashreport/maven-metadata.xml.
//        > Could not HEAD 'https://jcenter.bintray.com/com/tencent/bugly/nativecrashreport/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
//        > Could not resolve com.tencent.bugly:nativecrashreport:latest.release.
//                > Failed to list versions for com.tencent.bugly:nativecrashreport.
//                > Unable to load Maven meta-data from https://dl.bintray.com/jetbrains/anko/com/tencent/bugly/nativecrashreport/maven-metadata.xml.
//        > Could not get resource 'https://dl.bintray.com/jetbrains/anko/com/tencent/bugly/nativecrashreport/maven-metadata.xml'.
//        > Could not GET 'https://dl.bintray.com/jetbrains/anko/com/tencent/bugly/nativecrashreport/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
    }

感谢万能的群友!希望你遇到这种情况的时候能快速找到解决方案!

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐