我已经安装了新的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结尾),以确保它正在增长。给它足够的时间,因为它是一个大文件。

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

其他回答

快速修复:只要关闭你的防火墙,似乎android工作室想要下载一些东西,因为我们的防火墙阻止它下载它想要的文件,它就卡住了。

注意:关闭你的防火墙会降低你的安全性,如果你有时间,你可以允许android工作室在你的防火墙。通过这样做,你可以打开你的防火墙,同时允许android工作室下载任何它想要的东西。

对我有用的是:

创建一个虚拟项目,当它卡在Build屏幕上时, 终止studio进程。 打开android studio,打开项目,项目就会崩溃 用已经打开的虚拟项目创建一个新项目,它将毫无问题地创建项目 关闭虚拟项目,享受乐趣

我发现我的笔记本电脑也出现了同样的问题,尽管我等了很长时间。这就是我所做的,而且对我很有效。强行关闭Android Studio并再次启动。这一次,只需打开现有项目,让它负责完成构建/下载过程。

你可以尝试的另一个选项是,如果你查看File -> Settings,有一个Gradle location选项。你可以去Gradle下载站点,下载Gradle的本地发行版,并将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结尾),以确保它正在增长。给它足够的时间,因为它是一个大文件。

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

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