Build fails after applying a plugin

I’m attempting to apply the android-maven-gradle-plugin and it seems pretty straightforward.

I’m following the directions specified in the link above, namely:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "com.github.dcendents:android-maven-gradle-plugin:1.3"
  }
}

apply plugin: "com.github.dcendents.android-maven"

However, this is the error I get when I refresh Gradle dependencies:

FAILURE: Build failed with an exception.

* Where:
Build file '...\build.gradle' line: 67

* What went wrong:
A problem occurred evaluating root project 'Repository'.
> org.gradle.api.internal.project.ProjectInternal.getPluginManager()Lorg/gradle/api/internal/plugins/PluginManagerInternal;

Line 67 being the “apply plugin” line.


I believe that it does “find” the plugin because when I don’t provide the correct repository I instead get a different “cannot find plugin com.github.etc” error.

Any ideas what’s causing this? Would appreciate any help!

which version of Gradle are you using?

Sorry, should have given this info before.

I just ran gradlew -version which gave me

Gradle 2.2

Also for good measure, in build.gradle I have this under dependencies:

classpath 'com.android.tools.build:gradle:1.3.1'

Thanks, it looks like version 1.3 of the plugin is only valid for 2.4+:

Version 1.2 should work with Gradle 2.2, although it might be worth trying Gradle 2.4+ (but I don’t think the Android plugin official supports that).

Wow, I’ve seen that table before but for some reason just glanced over it, yep, that would definitely be the issue. Thanks a lot for taking the time to point that out to me, appreciate it!