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

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


当前回答

Gradle实际上包含在Android Studio中(至少在Mac OS X版本上)。我必须将其指向安装位置,在Android Studio应用程序的“包内容”(可以通过控制/右键单击应用程序图标来查看)。

其他回答

打开gradle-wrapper.properties 改变: distributionUrl = https /: / / services.gradle.org/distributions/gradle all.zip——4.4 : - 4.4 - all.zip distributionUrl = http://services.gradle.org/distributions/gradle

注意: 1. 我不关心SSL禁用下载gradle,但其他人可能是敏感的,所以这取决于你。 2. 注意gradle版本,在我的例子中是4.4。

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

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

是的,有。

Create a new project and you should Shutdown The Android Studio Application.(Because it takes a long time for you). Goto C:\Users\{Logged in User}\.gradle folder There is a folder there that show you which version of gradle Android Studio requires (e.g. gradle-1.8-bin) Download this version from internet (e.g. gradle-1.8-bin.zip). Goto C:\Users\{Logged in User}\.gradle\wrapper\dists\gradle-1.8-bin There is a folder here that its name is like a GUID. You should just copy the zip file that you've already downloaded from internet into this folder. Execute Android Studio and create a new project.

对我有用的是:

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

Gradle弹出窗口只显示断断续续的进度,对于了解下载是否卡住或非常慢并没有太大帮助。

这将有助于从命令行构建你的应用程序,在那里你可以得到下载的实际进展

./gradlew build