"Could not create plugin of type 'AppPlugin'" when mavenLocal()

(Peng DU) #1


Here are the key points in my build.gradle:

repositories {
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.2'

apply plugin: ‘com.android.application’

The error message:

A problem occurred evaluating root project ‘SDMobile’.

Failed to apply plugin [id ‘com.android.application’]
Could not create plugin of type ‘AppPlugin’.


(Benjamin Muschko) #2

It’s unlikely that you can resolve the Android plugins from your local Maven cache if it wasn’t resolved before. Try mavenCentral() instead.

(Peng DU) #3

Thanks, bmuschko.

It was after using mavenCentral.

I also installed the jar to C:\Users\dupeng.m2\repository\com\android\tools\build\gradle\2.1.2.

(Benjamin Muschko) #4

You can just rely on mavenCentral() and remove mavenLocal(). After it is downloaded to the local Gradle cache, it’s going to be reused. I’d stay away from using mavenLocal() if you do not have to work in an environment where you publish from Maven and consume with Gradle.