【问题标题】:Dependencies --> Could not create plugin of type 'AppPlugin'依赖项 --> 无法创建“AppPlugin”类型的插件
【发布时间】:2016-01-23 18:19:07
【问题描述】:

我正在尝试继续处理我的一个较旧的项目,它大约有一年的历史,当时运行良好,但现在我更新了 AndroidStudio,它甚至无法再构建。

我收到一条错误消息,提示我有两次相同的 dex 文件:

com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

要解决这个问题,我可以简单地执行“gradle dependencies”来找到罪魁祸首,并排除有问题的文件,但这是我遇到实际问题的地方。
当我执行“gradle dependencies”时,出现以下错误:

FAILURE: Build failed with an exception.      

* Where: 
Build file 'F:\Github\Coinbook\app\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not create plugin of type 'AppPlugin'.

* Try:   
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

这是我的完整 build.gradle 文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.moonrain.coinbook"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "0.7"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile project(':libs:AndroidBootstrap')

    compile files('libs/socialauth-4.4.jar')
    compile files('libs/socialauth-android-3.2.jar')

    compile 'com.doomonafireball.betterpickers:library:1.5.2'
    compile 'com.jakewharton:butterknife:6.0.0'
    compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
    compile 'com.github.castorflex.smoothprogressbar:library:1.0.0'
    compile 'com.squareup.picasso:picasso:2.3.4'
    compile 'com.readystatesoftware.systembartint:systembartint:1.0.4'
    compile 'com.google.code.gson:gson:2.3'
}

所以这是我现在基本上被卡住了,我尝试了以下方法来解决这个问题:
- 更新了 AndroidStudio
- 更新了所有 SDK 相关项目
- 更新了 gradle
- 在新文件夹中重新创建整个项目,然后将我的文件复制到新项目中

我发现的每篇关于这个问题的帖子都说使用 Gradle 0.7.3 而不是 0.7.2 因为一个错误。但这就像一年前一样,不再有效。

【问题讨论】:

  • 正如我在原帖中所说的,我已经找到了那个帖子,还有 10 个类似的帖子。最新版本的 AndroidStudio 需要 Gradle 2.2.1,我有。
  • 在 Cordova 脚本将我的 gradle 版本从 2.2.1 修改为 1.2 后,我也遇到了这个问题。将其设置回 2.2.1 修复它。
  • @Kasper 你的问题解决了吗?我的问题很相似,原因是 java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling (使用 --stacktrace 参数运行您的 gradle 命令以查看原因)。这只是一种解决方法,没有干净的解决方案,但我所做的是在 AndroidStudio 中构建项目,因为命令 shell 无法在不显示此错误的情况下处理构建过程。我想你的问题是相反的,尝试在命令外壳中构建。祝你好运。

标签: android build gradle


【解决方案1】:

尝试在 gradle/wrapper/gradle-wrapper.properties 中更改 gradle 版本

    distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip

类似

    distributionUrl=http\://services.gradle.org/distributions/gradle-2.2.1-all.zip

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-27
    • 1970-01-01
    • 2014-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多