前言
对于新手,在使用gradle的过程中往往会有很多问题。为此,我整理了一些新手在使用gradle构建时候常见的问题,以及解决方法。
Gradle常见问题及处理方法
Connection连接相关
Connection Reset
这个问题的报错一般为
A problem occurred configuring root project ‘Project’.
Could not resolve all artifacts for configuration ‘:classpath’.
Could not resolve …(此处为一个依赖的名字).
Required by:
project :
Could not resolve …(此处为一个依赖的名字).
Unable to load Maven meta-data from https://repo.spongepowered.org/repository/maven-public/org/… .
Could not HEAD ‘https://…/maven-metadata.xml’.
Connection reset
解决方法:
- 1.在idea的菜单中选择文件(File),然后点击清除缓存(Invalidate caches / Restart),最 后在弹出的对话框里面选择清除并重启启动(Invalidate and Restart)。
- 2.关闭Idea IDE
- 3.删除C盘下用户文件的**.gradle文件**(/home/{username}/.gradle)
- 4.再次打开Idea IDE
Connection reset
这个问题一般是由gradle下载不了导致的
解决方法:
手动到官网下载
官网网站是:https://services.gradle.org/distributions/
下载完以后解压到自己的文件夹下面