I have an android project I’ve been working on for a few weeks. I got a new computer recently and I wanted to work on this project. I downloaded the Android SDK and gradle. When I tried to run a build:

1
gradle assembleDebug

I got this error:

1
Gradle version 2.2 is required. Current version is 2.11. If using the gradle wrapper, try editing the distributionUrl in /home/you/repos/asdf/gradle/wrapper/gradle-wrapper.properties to gradle-2.2-all.zip

I think I had probably seen this error before and I just downloaded the right version of gradle. This time however I decided to take a look at Gradle wapper to see what it was about.

Once you have a version of Gradle installed it is easy to create a wrapper file. Since my build.gradle file is now in a “broken” state because it requires a version of Gradle that I don’t have installed, I will move it aside for a second:

1
mv build.gradle build.gradle.back

Since I want to use version 2.2 for my project I just needed to do this:

1
gradle wrapper --gradle-version 2.2

Now we can restore build.gradle:

1
mv build.gradle.back build.gradle

You will see some files being generated. All these files should be checked into version control because it will allow developers to compile the project even when they don’t have Gradle installed (The wrapper will install the correct version for them). To build the project you can now use the wrapper:

1
./gradlew assembleDebug
[ android  automation  mobile  productivity  ]
Managing Kubernetes Objects With Yaml Configurations
Introduction to Bazel
Monetizing a Jekyll blog with Adsense
Introduction to Simple Workflow Service (SWF)
Introduction to CloudFormation