简体   繁体   English

Gradle sync失败:'com.android.build.gradle.BasePlugin'没有实现Plugin接口

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

Environment : Android Studio 2.1 环境:Android Studio 2.1

Project : Android SDK + Cordova 项目:Android SDK + Cordova

Android Studio throws the following error during Gradle Sync : Android Studio在Gradle Sync期间抛出以下错误:

Gradle sync failed: 'com.android.build.gradle.BasePlugin' does not implement the Plugin interface Gradle sync失败:'com.android.build.gradle.BasePlugin'没有实现Plugin接口

Faced the same issue after upgrading to android studio 2.1 from 1.5 从1.5升级到android studio 2.1后面临同样的问题

Managed to resolve by updating the dependencies version if the gradle.gradleVersion >= 2.1 in the build.gradle file under buildscript {} 如果buildcript {}下的build.gradle文件中的gradle.gradleVersion> = 2.1 ,则通过更新依赖项版本来解决问题

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, 如果build.gradle中没有if / else子句可以直接更新依赖项,如下所示:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Cordova + Android Studio 错误:'com.android.build.gradle.BasePlugin' 没有实现插件接口 - Cordova + Android Studio Error:'com.android.build.gradle.BasePlugin' does not implement the Plugin interface Gradle 同步失败:原因:com/android/build/gradle/BaseExtension - Gradle sync failed: Cause: com/android/build/gradle/BaseExtension Gradle同步失败:找不到com.android.tools.build - Gradle Sync Failed: could not find com.android.tools.build Gradle 同步失败:找不到 com.android.tools.build:gradle-experimental:3.3.2 - Gradle sync failed: Could not find com.android.tools.build:gradle-experimental:3.3.2 Gradle 同步失败:找不到 com.android.tools.build:gradle:3.0.1 - Gradle sync failed: Could not find com.android.tools.build:gradle:3.0.1 Gradle 同步失败。 找不到 com.android.tools.build:gradle:3.4.0 - Gradle sync failed. Could not find com.android.tools.build:gradle:3.4.0 Gradle 同步在 AS 中失败:找不到 com.android.tools.build:Z8ED1A771BC236C287AD9326。 - Gradle Sync Failed In AS : Could not find com.android.tools.build:gradle:4.0.0 Android Studio Bug Gradle同步失败:找不到com.android.tools.build:gradle:3.1.3 - Android Studio Bug Gradle sync failed: Could not find com.android.tools.build:gradle:3.1.3 Gradle 同步失败:没有缓存版本的 com.android.tools.build:gradle:6.2.2 可用于离线模式 - Gradle sync failed: No cached version of com.android.tools.build:gradle:6.2.2 available for offline mode Gradle 同步失败:找不到 com.android.tools.build:gradle:5.6.4 - Gradle sync failed: Could not find com.android.tools.build:gradle:5.6.4
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM