Gradle Update Manually

Yup, i am using Debian 8 x64. Installing gradle with `apt-get install` gives me gradle version 1.5.
The project i have been doing requires version 2.2. Humm,  ok just download 2.10 from
https://services.gradle.org/distributions, copy and unzip into /opt/gradle-2.10

$ sudo chmod 777 /opt
$ wget https://services.gradle.org/distributions/gradle-2.10-all.zip
$ unzip gradle-2.10-all.zip

I rename the /usr/bin/gradle to
$ sudo mv /usr/bin/gradle /usr/bin/gradle-old

Append my ~/.bashrc with
export PATH=$PATH:/opt/android/platform/android-sdk-21/tools:/opt/android/platform/android-sdk-21/platform-tools:/opt/gradle-2.10/bin

Modify my android project gradle-wrapper.properties to

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=file:///opt/gradle-2.10/gradle-2.10-all.zip

Modify build.gradle to use gradle plugin at least 1.5.0 since older than that
will complain that 2.10 is lower than required 2.2

buildscript {
    repositories {
        jcenter()
    }

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

Then you are all set to compile and go :D

Comments