When importing the project, if in the file below

/gradle/wrapper/gradle-wrapper.properties configuration gradle version is not found locally

Because studio may need to climb the wall to download; There is no specific download progress, frustrating

So go to the official download a corresponding version

Go to http://gradle.org/gradle-download/ and click “Complete Distribution” to download gradle-a.b-all.zip

Then open the path to the local store, which on Windows might be C:\Users\Administrator\.gradle\wrapper\dists\… ;

MAC or Linux may be ~/.gradle/wrapper/dists/… In this directory are gradle versions

Version of the directory similar to the random name “five hmjbi6sa2kx80qyfwn0cfc9d”, is one to download the generated a random directory

Go to a random directory in the corresponding version directory, move the ZIP file to this directory, and decompress it

Finally, re-import the project



Relative shortcuts to downloading: When Studio reminds you to update Gradle, you click something like Install after the project is under

/gradle/wrapper/gradle-wrapper.properties will be updated, open it:

Locate the distributionUrl, copy the following address to a download tool such as a browser or thunderbolt, and download it.

Once the download is complete, repeat the above steps

The gradle-wrapper.properties file in the target project will be found if “Build Gradle project info” appears.

Find the distributionUrl, download it, and follow the steps above



If you already have a local version of Gradle; Gradle-wrapper.properties can be added if it is not the version configured in the target project

Change the gradle version configured in distributionUrl to the local gradle version. Note that characters such as HTTP do not need to be changed. You only need to change the Gradle version

As shown in the figure, gradle-2.2.1-all is the version number





Gradle can be copied from locally compiled projects by updating build.gradle under project

[plain]
view plain
copy
print
?

  1. dependencies {  
  2. The classpath ‘com. Android. Tools. Build: gradle: 2.1.0 – alpha5’
  3.   
  4.     // NOTE: Do not place your application dependencies here; they belong  
  5.     // in the individual module build.gradle files  
  6. }  
Dependencies {classpath 'com. Android. View the build: gradle: 2.1.0 - alpha5' / / NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files }Copy the code

Property node classpath is the Gradle version of the gradle plugin used in Studio

About plug-in version number and gradle version number corresponding relation, see: developer. The android, Google. Cn/studio/rele…



— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — –



If there is a local gradle configured project that is friendly to open

So that’s easy. I just need to put this project under

gradle

gradle.properties

gradlew

gradlew.bat

These files and folders are copied to the target project

Synchronize gradle versions configured in build.gradle under the target project

Notice An earlier version is compatible with an earlier version. If you change the version from an earlier version to an earlier version, some plug-ins or features may become invalid