如何删除通过 gradle 添加的重复库?

Aru*_*haN 2 android android-library android-gradle-plugin

我在我的项目中使用了两个库。一个是这个,另一个是这个

每当我使用 Edit Test 库运行应用程序时,它都会显示UNEXPECTED TOP-LEVEL EXCEPTION

Error:Execution failed for task ':mobile:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    E:\Android\me\me\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Project\RemoteiT\RemoteiT\mobile\build\intermediates\dex\debug --input-list=C:\Project\RemoteiT\RemoteiT\mobile\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
    2
Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dex.DexException: Multiple dex files define Lcom/nineoldandroids/animation/Animator$AnimatorListener;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
        at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
        at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
        at com.android.dx.command.dexer.Main.run(Main.java:246)
        at com.android.dx.command.dexer.Main.main(Main.java:215)
        at com.android.dx.command.Main.main(Main.java:106)
Run Code Online (Sandbox Code Playgroud)

我假设上面的错误表明com.nineoldandroids添加了两次或冲突。

所以我试图在 build.gradle 文件中删除它。但它仍然显示错误!

我的假设是对的吗?还是我在其他地方出错了?

构建.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "me.aruhan.remt"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

configurations {
    // to avoid double inclusion of support libraries
    all*.exclude group: 'com.nineoldandroids', module: 'materialDesign'
}

dependencies {
    compile 'com.android.support:appcompat-v7:21.0.0'
    compile project(':materialDesign')
    compile 'com.rengwuxian.materialedittext:library:1.7.1'
}
Run Code Online (Sandbox Code Playgroud)

Aru*_*haN 5

而不是在配置中添加它。我只为这样的库添加了排除:

compile ('com.rengwuxian.materialedittext:library:1.7.1') {
   exclude group: 'com.nineoldandroids', module: 'library'
}
Run Code Online (Sandbox Code Playgroud)