android studio gradle 插件无法下载,gradle:3.2.0

解决在Android项目 gradle build时,总是报错Could not GET xxx, Received status code 400 from server: Bad Request的问题

在网上看了好几个是这样配置的,但是 还是好使

在安卓项目编译的时候,gradle-xx-all.zip配置好了,还是不行,发现还是在去网络上下载东西,其实这时候下载的是gradle的编译插件,也就是build.gradle里的这个东西:
 

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    
    repositories {
        google()
        jcenter()
        maven {
            url 'http://maven.aliyun.com/nexus/content/groups/public/'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

 

 

后来发现 Gradle 提示的  400 url, 我在浏览器里面是可以直接下载的。应该是本地哪里配置出错了

因后发现是代理问题。你需要进去你的gradle缓存目录,一般也就是用户目录/.gradle/gradle.properties,把其中配置的所有代理都注释掉就ok了。

## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Thu Dec 13 17:14:56 CST 2018

#systemProp.https.proxyPort=80
#systemProp.http.proxyHost=mirrors.neusoft.edu.cn
#systemProp.https.proxyHost=mirrors.neusoft.edu.cn
#systemProp.http.proxyPort=80

猜你喜欢

转载自blog.csdn.net/nicepainkiller/article/details/85003106
今日推荐