I am trying to build u202 android project by Jake Wharton. My android studio is failing to build the project. The error being shown is as below:
Gradle 2.1 is required
Migrate to Gradle wrapper and sync project
The line where error is shown points to apply plugin: 'com.android.application'
in the build.gradle
file.
I have tried the following solutions but to no avail.
- Run
gradlew
from the highest project directory. However when I run this from command line, I get a message that the build was successful but when I try to sync the project in android studio I get the above mentioned error. - Run gradle through command line. Since the gradle version I had in my path was of version 2.2.1, I got the error that plugin "com.android.application" cannot be found - I assume this is because I have this version of gradle-plugin in the project which needs to be updated to support newer version of gradle: 'com.android.tools.build:gradle:0.13.3'
Finally I could build the project by downloading gradle 2.1 manually and pointing the project to use local gradle instead of wrapper. I wanted to know if there is anything wrong in the way I tried to use gradle wrapper.