android studio of Gradle been in sync the way

After the upgrade android studio, open a new project, the results gradle sync sync not been completed, this situation is common, there are many ways to solve online, most do not have a point. . .

Below you spend five minutes to look at, it could save you an hour. . .

  1. android studio at this time what to do when gradle sync

Actually very simple, we analyze what have done during sync, it is in fact a version of the download wrapper (ie gradle-wrapper.properties in specified distributionUrl), this time because the network is not smooth caused.
For example, we see gradle-wrapper.properties

#Sat Nov 18 08:36:48 CST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip

If the android studio found no .gradle / wrapper / dists / gralde- 4.4-all this directory, create it, and generate an empty file gradle-4.4-all.zip.lck and download gradle-4.4-all.zip.part , after downloading, the file will .part renamed gralde-4.4-all.zip and extract into gradle-4.4 folder,
delete files .part generate empty file gradle-4.4-all.zip.ok tell android studio, this live I finished my work, doing OK.

2. how do can skip the lengthy downloads

First turn off the android studio.
Open .gradle / wrapper / dists directory, find the version number of the document distributionUrl specified folder.
1) download from the Internet http://services.gradle.org/distributions/ gradle-4.4-all.zip appropriate, into the folder, and extract
2) delete the .part
3) create gradle-4.4-all .zip.ok (critical!)
4) start android studio, normal sync

The ultimate success of the file directory content is below

 
image.png

[End]



Author: Qingdao Bridge _Android-to-back
link: https: //www.jianshu.com/p/24a38f8400cc
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.

Guess you like

Origin www.cnblogs.com/geili/p/11258202.html