Gradle wrapper version in sub-module is different than in project root

1.4k Views Asked by At

I am new in Android studio & Gradle.

My project structure is like this:

MyProject
  -LibModuleOne
    -...
    -build.gradle
  -LibModuleTwo
    - ...
    -buld.gradle
  -AppModule
    -...
    -build.gradle
buld.gradle

On command line, under MyProject/ , ./gradlew --version shows me that I am using gradle 2.1:

./gradlew --version

------------------------------------------------------------
Gradle 2.1
------------------------------------------------------------

Build time:   2014-09-08 10:40:39 UTC
Build number: none
Revision:     e6cf70745ac11fa943e19294d19a2c527a669a53

Groovy:       2.3.6
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
JVM:          1.8.0_25 (Oracle Corporation 25.25-b02)
OS:           Mac OS X 10.8.5 x86_64

But, if I check the version under MyProject/LibModuleOne/ or MyProject/LibModuleTwo/ or MyProject/AppModule/ they all show me that I am using gradle 1.12:

./gradlew --version

------------------------------------------------------------
Gradle 1.12
------------------------------------------------------------

Build time:   2014-04-29 09:24:31 UTC
Build number: none
Revision:     a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:       1.8.6
Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
Ivy:          2.2.0
JVM:          1.8.0_25 (Oracle Corporation 25.25-b02)
OS:           Mac OS X 10.8.5 x86_64

The build.gradle of project root declares using Android plugin version0.13.3 :

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
        mavenLocal()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.13.3'
    }
} 

In Android studio, File-->Project structure --> shows Gradle 2.1

Why gradle wrapper shows different version in sub-modules than project root ? How to make all my sub-modules use Gradle 2.1 ?

1

There are 1 best solutions below

0
On

You appear to have multiple wrappers installed (otherwise ./gradlew wouldn't work from subdirectories). You need to remove all gradlew scripts and gradle/wrapper directories except for the ones in the root project's directory.