NullPointerException
NullPointerException

Reputation: 37733

Different Gradle versions in my project (gradle.xml vs build.gradle)

In gradle.xml I have version 2.4 ( C:\Development\android-studio\gradle\gradle-2.4 ):

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="GradleSettings">
    <option name="linkedExternalProjectsSettings">
      <GradleProjectSettings>
        <option name="distributionType" value="LOCAL" />
        <option name="externalProjectPath" value="$PROJECT_DIR$" />
        <option name="gradleHome" value="C:\Development\android-studio\gradle\gradle-2.4" />
        <option name="gradleJvm" value="1.8" />
        <option name="modules">
          <set>
            <option value="$PROJECT_DIR$" />
            <option value="$PROJECT_DIR$/caponateLibrary" />
            <option value="$PROJECT_DIR$/launcher" />
          </set>
        </option>
      </GradleProjectSettings>
    </option>
  </component>
</project>

But in my Project uild.gradle file I have 1.3.0:

    dependencies {
        classpath 'com.android.tools.build:gradle:1.3.0'
    }

Why these files have different Gradle versions? Which differences does exists between these two Gradle versions and which is the real Gradle version?

Upvotes: 4

Views: 3050

Answers (2)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364948

Don't confuse gradle distribution and the android plugin for gradle.

1) You can define the gradle distribution used by a project in the file gradle/wrapper/gradle-wrapper.properties

For example:

distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-2.4-all.zip

Each project can use a different version. You will find the distributions file inside \user\.gradle\wrapper\dists folder.

2) Gradle is a build tool, but it requires specific plugin to work. Android Tool Team is releasing the Android plugin for Gradle.

You can define the plugin inside the build.gradle file in the project.

For example:

  classpath 'com.android.tools.build:gradle:1.3.1'
  classpath 'com.android.tools.build:gradle:1.5.0'

Each project (or module) can use a different version.

Upvotes: 7

RaGe
RaGe

Reputation: 23805

The first one is actual gradle binaries, and hence actual gradle version. The second is (IMO) unfortunately named, and isn't gradle at all. It is android plugin for gradle and its version.

Upvotes: 1

Related Questions