受欢迎的博客标签

Android|Android Studio-Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-7.0.2-bin.zip'.

Published

OS: Window 10

Android Studio:2020.3.1 | pach 4

 

step 1: check gloable https.proxyHost,set to no proxy

C:\Users\Administrator2\.gradle
C:\Users\Administrator2\.gradle\gradle.properties

## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Fri Dec 10 00:46:37 CST 2021
systemProp.http.proxyHost=mirrors.neusoft.edu.cn
systemProp.https.proxyHost=mirrors.neusoft.edu.cn
systemProp.https.proxyPort=443
systemProp.http.proxyPort=80
 
 
Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-7.0.2-bin.zip'.

I have just installed Android Studio 2020.3.1 | pach 4 on windows 10 and then created new project then above exception occurs.

Are you facing a “Gradle distribution” error while working on your Android project and you don’t know how to fix it?

 

Don’t worry, you have landed on the right website. Here, I am going to show the solution how to overcome this error.

There are different ways to solve your error. Try the below procedures:

1) Invalidate Caches/Restart

Sometimes, the invalidate caches might cause an error. Try to restart your project. Click File -> Invalidate Caches/ Restart.


 

Step 2: Sync Project With Gradle Files

Sync your project with Gradle files sometimes solves your problem. Check out this way. Select File -> Sync Project with Gradle Files

 

Step 3: Delete Gradle-6.5 folder

It could be that Gradle-6.5 distribution was not downloaded properly. So, go to the following directory and delete Gradle-6.5.

C:/Users/Your Username/ .gradle/wrapper/dists/gradle-6.9.1-all

Restart your Android Studio, it will download the Gradle file again.


 

Step 4: Manually Install Gradle distribution

If the above solution did not work, try to install Gradle-6.5 Distribution manually. Here, is a procedure to do.

  1. Download the latest Gradle Distribution and extract the .zip under

view root file named with gradle-wrapper.properties in your project

Just find gradle-wrapper.properties in your IDE

path:\<project directory\>\gradle\wrapper\gradle-wrapper.properties

gradle/wrapper/gradle-wrapper.properties
#Sun Dec 12 08:46:35 CST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

 

download gradle-7.0.2-bin.zip manually from https://downloads.gradle-dn.com/distributions/gradle-7.0.2-bin.zip and extract the file

download from:https://downloads.gradle-dn.com/distributions/gradle-7.0.2-bin.zip

upzip it 

copy to 

cd C:\Users\Administrator2\.gradle\wrapper\dists\gradle-7.0.2-bin\gradle-7.0.2
copy F:\googleDownload\gradle-7.0.2-bin.zip\gradle-7.0.2  to C:\Users\Administrator2\.gradle\wrapper\dists\gradle-7.0.2-bin\gradle-7.0.2


cd C:\Users\Administrator2\.gradle\wrapper\dists\gradle-7.0.2-bin\gradle-7.0.2

C:\Users\Administrator2\.gradle\wrapper\dists\gradle-7.0.2-bin\gradle-7.0.2>dir
 

 C:\Users\Administrator\.gradle\wrapper\dists\gradle-7.0.2-bin\gradle-7.0.2 的目录

2021/12/13  01:57    <DIR>          .
2021/12/13  01:57    <DIR>          ..
2021/12/13  01:57    <DIR>          bin
2021/12/13  01:57    <DIR>          init.d
2021/12/13  01:57    <DIR>          lib
2021/12/13  01:57            23,606 LICENSE
2021/12/13  01:57               803 NOTICE
2021/12/13  01:57               976 README
               3 个文件         25,385 字节
               5 个目录  1,724,923,904 可用字节

C:\Users\Administrator\.gradle\wrapper\dists\gradle-7.0.2-bin\gradle-7.0.2>

 

C:/Users/Your Username/ .gradle/wrapper/dists/

2. File -> Settings…

 

3. Select Build, Execution,Deployment -> Gradle

4. Select your extracted gradle distribution location on “Gradle user home” and click apply and OK.

5. Now, the Android Studio will start to download the gradle file.

That’s it. I hope your problem is solved by one of these above process.

 



  •