Java Android Studio 2.3 错误:“Gradle 同步失败:原因:services.gradle.org”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42787524/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:24:24  来源:igfitidea点击:

Android Studio 2.3 error: "Gradle sync failed: Cause: services.gradle.org"

javaandroidgradleandroid-gradle-plugin

提问by Leyla Bilen

After I open a new project in Android Studio 2.3, I receive an error such as:

在 Android Studio 2.3 中打开一个新项目后,我收到一个错误,例如:

Gradle sync failed: Cause: services.gradle.org

Gradle 同步失败:原因:services.gradle.org

Googling just gave me a log file on an issue tracker page. I have tried uninstalling/reinstalling. I am not behind a proxy and I've already set:

谷歌搜索只是在问题跟踪页面上给了我一个日志文件。我试过卸载/重新安装。我不在代理后面,我已经设置了:

Use default gradle wrapper

Restarting Gradle sync stops at

重新启动 Gradle 同步停止于

Refreshing Gradle project

刷新 Gradle 项目

I can't find anything to fix this problem. I am running Android Studio on Windows 8.1 with JRE 1.8.0

我找不到任何东西来解决这个问题。我正在使用 JRE 1.8.0 在 Windows 8.1 上运行 Android Studio

回答by jaya

I also faced the same problem. You have two ways to solve this.

我也面临同样的问题。你有两种方法来解决这个问题。

First one is to connect to the Internet and download a new version of Android Studio and the required packages.

第一个是连接到互联网并下载新版本的 Android Studio 和所需的包。

Note: You should have "proxies" and "offline work" options enabled.

注意:您应该启用“代理”和“离线工作”选项。

The second way is to go to file > settings > build > gradleand do the following:

第二种方法是转到file > settings > build > gradle并执行以下操作:

  1. Uncheck the "offline work" option.
  2. Use local gradle distribution and then set the path.
  1. 取消选中“离线工作”选项。
  2. 使用本地 gradle 分发,然后设置路径。

Note: When you have "no proxy" option checked with "offline work" then you have to provide path for every new project.

注意:当您使用“离线工作”选中“无代理”选项时,您必须为每个新项目提供路径。

回答by Pascal Chidi

I Guess This Can Help You..... https://gradle.org/install

我想这可以帮助你..... https://gradle.org/install

// for manual installation to get the gradle distribution visit

// 手动安装获取gradle发行版访问

https;//gradle.org/release

https;//gradle.org/release

STEPS

脚步

1 Dowmload the gradle

1 下载gradle

2 unzip the pack.

2 解压缩包。

3 create a new folder in your C drive and name it gradle

3 在C盘新建一个文件夹,命名为gradle

4 place the unzipped pack into the folder you created

4 将解压后的包放入你创建的文件夹中

5 Now set the path for your gradle in Android Studio to the just created folder

5 现在将 Android Studio 中的 gradle 路径设置为刚刚创建的文件夹

6 Add the path of your gradle to the System Varaibles.

6 将 gradle 的路径添加到系统变量中。

7 Computer, right click >Properties>Advance System Settings>Enviroment Varaibles>System Varaibles.Path>Edit.

7 计算机,右键单击>属性>高级系统设置>环境变量>系统变量.路径>编辑。

Hope its Helpful

希望它有帮助

回答by Ahamed Rasheed

I had the same problem. so i followed this https://docs.gradle.org/current/userguide/userguide_single.html#installationfinally i got it !!

我有同样的问题。所以我跟着这个https://docs.gradle.org/current/userguide/userguide_single.html#installation终于我明白了!!

Android Stidio v 3.0.1

Android Stdio v 3.0.1

回答by CrandellWS

I have this issue and have tried reinstalling to no avail.

我有这个问题,并尝试重新安装无济于事。

What I found was useful is to look in my home directory (on Ubuntu) and open the .gradle folder and open the matching sub folder and delete the lck file and then manually download the desired gradle version (url distributionUrl value) and place the downloaded file in the folder that had the lck file.

我发现有用的是查看我的主目录(在 Ubuntu 上)并打开 .gradle 文件夹并打开匹配的子文件夹并删除 lck 文件,然后手动下载所需的 gradle 版本(url distributionUrl 值)并放置下载的包含 lck 文件的文件夹中的文件。

Have attributed this problem to using usb tethering for internet..

将此问题归因于使用 USB 网络共享上网。

enter image description here

在此处输入图片说明