解决 Received status code 502 from

2022-05-06  本文已影响0人  职场过客

项目本来是可以运行的,突然编译报错

Could not GET 'https://google.bintray.com/exoplayer/com/google/firebase/firebase-iid/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
Enable Gradle 'offline mode' and sync project

解决办法一:
添加阿里云的代理库
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
两个地方都要添加
添加一:

buildscript {
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.google.gms:google-services:4.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

添加二:

allprojects {
    ext.support_lib_version = '28.0.0'
    ext.gson_version = '2.8.5'
    ext.okhttp_version = '3.12.3'
    repositories {
   from another repo
        maven {url 'https://jitpack.io'}
        google()
        maven { url "https://maven.google.com"}
        jcenter()
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }

    }
}

运行后完美解决

如果不行的话 解决办法二:
1.满足解决办法一,把代理添加好
2.删掉这个文件夹build,重新编译,或者直接run
3.删掉这个文件夹build和.idea,重新编译,或者直接run

image.png
其实这些都跟你的maven有关还有项目下面的build有关,
既然要从离线从缓存中查找:
No cached version available for offline mode
找不到这个就一直重复这样的问题。现在只需要把build文件夹删除就好了。
上一篇下一篇

猜你喜欢

热点阅读