我已经安装了新的Android Studio。一切都工作得很好,但当我试图创建一个新项目时,它在下载Gradle时卡住了。

有没有办法手动安装Android Studio所需的Gradle ?或者有其他方法可以解决这个问题吗?


当前回答

If you're using OS X, and it continues to hang indefinitely, I'd recommend shutting down Android Studio (may have to force kill), then going to your ~/.gradle directory on the console. You'll see a wrapper/dists directory there and whatever version of gradle AS is trying to download. Check the timestamp of the download underneath the randomly named subdirectory. If you see that it is never changing, most likely your download was interrupted and AS wasn't able to restart it properly and will not unless you delete everything below the dists directory and start over.

因此,当AS关闭时,删除~/下面的所有内容。gradle/wrapper/dist,然后在AS中重新尝试一个新项目。您可以检查gradle下载文件的进度(它将以.part结尾),以确保它正在增长。给它足够的时间,因为它是一个大文件。

这就是最后对我有用的方法。

其他回答

Windows用户

使用您的网络资源监视器

打开任务管理器[Ctrl+Shift+Esc]

性能选项卡

开放资源监视器(从底部开始)

首先,我决定在阅读完这里的答案后等待。但能持续多久?如何确保它能完成?他们应该提供下载百分比,但他们没有。为了了解正在进行的某些进程,打开这个网络资源监视器,它会显示正在下载Studio64.exe。如果不是(如果它显示0B/Sec),那么要么网络不可用,要么应用程序没有响应。

它不会卡住,通常会花一些时间5-7分钟,这也取决于互联网连接,所以等待一段时间。它只需要第一次发射时间。

更新:检查C:\Users\<User>\.gradle\daemon\x中的最新日志文件。Y文件夹查看下载的内容。

我通过删除.gradle文件夹解决了这个问题

在windows中: C:\Users{已登录用户}.gradle

是的,你可以在Android Studio之前手动安装Gradle,首先将Gradle安装在任何位置,然后将de gladle位置添加到路径变量(在环境变量窗口中)。

使缓存无效并重新启动

这对我很管用。