Gradle sync failed: 'com.android.build.gradle.BasePlugin' does not implement the Plugin interface

我只是一个虾纸丫 提交于 2019-11-28 21:13:11

问题


Environment : Android Studio 2.1

Project : Android SDK + Cordova

Android Studio throws the following error during Gradle Sync :

Gradle sync failed: 'com.android.build.gradle.BasePlugin' does not implement the Plugin interface


回答1:


Faced the same issue after upgrading to android studio 2.1 from 1.5

Managed to resolve by updating the dependencies version if the gradle.gradleVersion >= 2.1 in the build.gradle file under buildscript {}

OLD Configuration

 if (gradle.gradleVersion >= "2.2") {
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
} else if (gradle.gradleVersion >= "2.1") {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.14.0+'
    }
} else {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.0+'
    }
}

Updated Configuration

if (gradle.gradleVersion >= "2.2") {
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
    }
} else if (gradle.gradleVersion >= "2.1") {
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
    }
} else {
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.0+'
    }
}

If you do not have if/else clause in your build.gradle you can update the dependencies directly as below,

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
}


来源:https://stackoverflow.com/questions/36925531/gradle-sync-failed-com-android-build-gradle-baseplugin-does-not-implement-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!