Gradle version 2.2 is required. Current version is 2.10

I am trying to use gradle build. It gives me error saying that Failed to apply plugin [id 'com.android.library'] Gradle version 2.2 is required. Current version is 2.10. If using the gradle w...