Hi. I am trying to shift to Gradle from maven. I want to use gradle wrapper in my gradle build. So I added wrapper task to my project’s build.gradle as -
task wrapper(type: Wrapper) {
gradleVersion = '1.6'
}
But when I am trying to run my build I am getting this error -
A problem occurred evaluating root project 'MyProject'.
> Cannot create task of type 'Wrapper' as it does not implement the Task interface.
Any idea what I am doing wrong ?
That’s odd. Which Gradle version? Does it help to replace ‘Wrapper’ with ‘org.gradle.api.tasks.wrapper.Wrapper’?
Thanks Peter. Replacing Wrapper with org.gradle.api.tasks.wrapper.Wrapper resolved the issue. I am using Gradle 1.6.
Is the build using any third-party plugins? What does ‘println Wrapper.name’ print?
I am using three plugins -
apply plugin: 'android-library'
apply plugin: 'robolectric'
apply plugin: 'maven'
And println Wrapper.name is giving ‘java.sql.Wrapper’ .
Can you double-check that you don’t have ‘import java.sql.Wrapper’ in your build script?
Oh yeah, somehow import java.sql.Wrapper got added in my build.gradle . I am building my project in Android Studio, so it is automatically importing java.sql.wraper in my build script.