全部错误是这样的:

Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.1.2/gradle-3.1.2.pom'. Received status code 400 from server: Bad Request。

遇到这个错了以后,我先后做了以下尝试:

  • 手动下载确认链接无误。
  • 查询400 code,意思大概是客户端请求语法问题或者参数有问题。这样就很有可能是代理出问题了。
  • 关闭了VPN,关闭Android Studio的代理,全部无效。
  • ping dl.google.com 没问题。
  • 重装Android Studio,删除所有配置文件,无效。
  • 建立新的空的工程无效。
  • 确认执行build命令的主体是gradle。那么可能是gradle配置了错误的代理?那么gradle的代理在哪里配置呢??

最后这一步拯救了浪费了一整个下午排错的我。所以最后我遇到的问题是:

Gradle不知道在什么时候被配置了一个错误的代理!Gradle的代理配置路径是:

C:\Users\***\.gradle\gradle.properties

## 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#Tue May 15 12:14:36 CST 2018systemProp.https.proxyPort=80systemProp.http.proxyHost=mirrors.neusoft.edu.cnsystemProp.https.proxyHost=mirrors.neusoft.edu.cn systemProp.http.proxyPort=80

删除最后四行的代理就恢复正常了!

到此这篇关于Gradle build 报错:Received status code 400 from server的文章就介绍到这了,更多相关Gradle build 报错内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家! 

更多相关文章

  1. Both setBehindContentView must be called in onCreate in addi
  2. android vlc源码编译
  3. Android(安卓)NDK *** could not be resolved
  4. android studio 编译调试 错误
  5. android INSTALL_FAILED_INSUFFICIENT_STORAGE调试错误的解决
  6. Android(安卓)error: "Apostrophe not preceded by \"错误解决
  7. android错误信息大整理
  8. 如何解决向eclipse导入android project时遇到错误“Invalid proj
  9. MediaPlayer的错误列表速查(android)

随机推荐

  1. Android核心模块及相关技术介绍
  2. Android开源工具库
  3. android中实现百度地图
  4. Android--Intent的使用
  5. Android基于XMPP Smack openfire 开发的
  6. Android(安卓)synchronized用法
  7. Android截屏截图的几种方法总结
  8. android设置鼠标速度
  9. Android Eclipse关联本地android API doc
  10. 完整版仿360等手机卫士火箭拖动版