Gradle build Comments (gradle-wrapper.properties)

When Android Studio to open a project: Principles

  1. It reads gradle-wrapper.properties file, so they know which version of the project required gradle
  2. Then it will go to save gradle folder GRADLE_USER_HOME deposit gradle go see this version does not exist, there is no will to distributionUrl to download
  3. The reason is so slow to open the card in the download gradle this step, then download their own gralde, and then configure up on it
    1. Modify gradle-wrapper.properties in distributionUrl, we want to change the version, just change the version back on it, do not change the previous section
    2. Open the project, this time AS will automatically download gradle, and created the directory. Then to kill the Android Studio and exit, since this step is to get the download directory AS created automatically, navigate to the following directory:
      windows: C:\users\yonghuming\.gradle\wrapper\dists
      Note: Gradle is shared by everyone, so of course not in the Gradle project file (not without can)
      then enter the corresponding version of gradle folder, you will find a bunch of garbled folder
    3. Download gradle, from the top {your project}/gradle/wrapper/gradle-wrapper.propertiesdown Gradle Download files, download the corresponding version of gradle, the image above to download a bunch of garbled copy gradle-2.4-all.zip folder, be careful not to unpack.
    4. Re-open Android Studio, open the project
      in addition, to note that, gradle plug and gradle are two separate things, gradle plug-in version of the project is determined by the outermost build.gradle file
      app / build.gradle:
      buildscript {
          repositories {
              jcenter()
          }
          dependencies {
              classpath 'com.android.tools.build: gradle:2.1.0'
              // NOTE: Do not place your application dependencies here; they belong
              // in the individual module build.gradle files
          }
      }

gradle plug-in version of the problem:
  Select studio installation directory, and then go to the directory structure can be viewed gradle corresponding plug-in version, the version corresponding to the configuration in the corresponding configuration file: as

    dependencies {
    classpath ‘com.Android.tools.build: gradle:1.5.0’
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }

android-studio \ gradle \ m2repository \ \ android \ tools \ build \ gradle you can see all plug-com version

Project Structure in the left side of the dialog box, select Project

On the right side of the dialog box you can see the version and the version of Gradle Gradle plugin

Plugin version ——— Required Gradle version
1.0.0 - 1.1.3 ——— 2.2.1 - 2.3
1.2.0 - 1.3.1 ——— 2.2.1 - 2.9
1.5.0 ——— 2.2.1 - 2.13
2.0.0 - 2.1.2 ——— 2.10 - 2.13
2.1.3+ ——— 2.14.1+

<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">

Guess you like

Origin www.cnblogs.com/jichui/p/11743133.html