美文网首页
Android Studio 加载 gradle报错 Could

Android Studio 加载 gradle报错 Could

作者: 不良偉 | 来源:发表于2021-03-07 19:14 被阅读0次
image.jpeg

这里报错是指android studio gradle插件无法下载。
Could not GET xxx, Received status code 400 from server: Bad Request.
gradle的编译插件,也就是项目级build.gradle里的这个东西。

buildscript {
    repositories {
        google()
        jcenter()
        
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

所以这个插件会根据你配置在项目级build.gradle中的maven url去远程下载,这里的本地缓存目录在用户目录/.gradle/caches/modules-2/files-2.1/
我配置了阿里云的地址也下载不了,直接报400的错,而且在我复制下载地址去网页访问发现都是正常的。找半天原因后发现是代理问题。需要进去gradle缓存目录,一般也就是用户目录/.gradle/gradle.properties
,把其中配置的所有代理都注释掉就ok了。

image.png

相关文章

网友评论

      本文标题:Android Studio 加载 gradle报错 Could

      本文链接:https://www.haomeiwen.com/subject/ywyyqltx.html