简体   繁体   English

Gradle:下载 gradle 需要“很长时间”,activity_main.xml 一直显示“正在加载”

[英]Gradle: download gradle takes “very long time”, activity_main.xml keeps showing “Loading”

I have installed Android Studio today.我今天已经安装了 Android Studio。 I'm a newbie to Android development.我是 Android 开发的新手。 I know that it has been asked several times, but my Android Studio is most updated as of now, so none of the solution seems to work.我知道它已经被问过好几次了,但是我的 Android Studio 目前是最新的,所以似乎没有一个解决方案有效。 [AndroidStudio v3.6] [AndroidStudio v3.6]

After the installation got over, I attempted to create an Empty Project.安装完成后,我尝试创建一个空项目。 It opened the whole project as seen below,它打开了整个项目,如下所示,

在此处输入图像描述

After waiting for 7+ minutes (bottom-left), gradle is still not downloaded, and the activity_main.xml file keeps showing "Loading".等待 7 分钟以上(左下),gradle 仍未下载, activity_main.xml文件一直显示“正在加载”。

Solution 1 - Change the gradle location解决方案 1 - 更改 gradle 位置

I found this location to C:\Users\RAHUL.LAPTOP-DISIIAS2\.gradle\wrapper\dists\gradle-5.6.4-all\ankdp27end7byghfw1q2sw75f , but it contains two files - one is gradle-5.6.4-all.zip.part and other is gradle-5.6.4-all.zip.lck file.我发现这个位置是C:\Users\RAHUL.LAPTOP-DISIIAS2\.gradle\wrapper\dists\gradle-5.6.4-all\ankdp27end7byghfw1q2sw75f ,但它包含两个文件 - 一个是gradle-5.6.4-all.zip.part和 other 是gradle-5.6.4-all.zip.lck文件。

Solution 2 - Invalidate and restart解决方案 2 - 无效并重新启动

Doesn't seem to work似乎不起作用

Solution 3 - Change gradle settings to work in offline mode解决方案 3 - 更改 gradle 设置以在离线模式下工作

The version I'm using doesn't have the option我使用的版本没有选项

在此处输入图像描述

How can I fix it?我该如何解决?


Here is my gradle-wrapper.properties file:这是我的gradle-wrapper.properties文件:

在此处输入图像描述

First, check if you are connected to http\://services.gradle.org/distributions with ping command in Command Prompt.首先,使用命令提示符中的ping命令检查您是否连接到http\://services.gradle.org/distributions If you are connected, then change Proxy Settings in Android Studio to Use System Proxy .如果您已连接,则将 Android Studio 中的 Proxy Settings 更改为Use System Proxy If it is downloading slowly again, your internet connection may be slow.如果它再次下载缓慢,您的互联网连接可能很慢。 Or you best fallow guidelines in this link: Gradle Download: Installing Manually或者您最好在此链接中使用休闲指南: Gradle 下载:手动安装

Then work in offline mode will appear in your settings.然后在离线模式下工作将出现在您的设置中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM