多个dex文件定义android / support / annotation / AnimRes

时间:2015-05-29 20:08:51

标签: android gradle dex

当我想运行我的应用程序时,我收到以下错误:

app:compileDebugNdk UP-TO-DATE :应用:compileDebugSources :应用:preDexDebug :应用:dexDebug 意外的顶级例外情况: com.android.dex.DexException:多个dex文件定义Landroid / support / annotation / AnimRes;     在com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)     在com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)     在com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)     在com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)     在com.android.dx.merge.DexMerger.merge(DexMerger.java:189)     在com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)     在com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)     在com.android.dx.command.dexer.Main.run(Main.java:246)     在com.android.dx.command.dexer.Main.main(Main.java:215)     在com.android.dx.command.Main.main(Main.java:106) 错误:任务':app:dexDebug'。

的执行失败
  

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令' C:\ Program Files(x86)\ Java \ jdk1.8.0_05 \斌\ java.exe的''完成非零退出值2

gradle脚本的内容是:



buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 21
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        minSdkVersion 10
        targetSdkVersion 22
        versionCode 289
        versionName "2.2.0"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles 'proguard-android.txt', 'proguard-rules.txt'
        }
        debug {
            debuggable true
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.google.android.gms:play-services-location:7.5.0'
    compile 'com.google.android.gms:play-services-maps:7.5.0'
    compile('com.facebook.android:facebook-android-sdk:3.23.1') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile('com.crashlytics.sdk.android:crashlytics:2.3.1@aar') {
        transitive = true;
    }
    compile project(':UtilsLibrary')
    compile project(':NumberPickerLibrary')
    compile project(':drag-sort-listview-lib')
    compile project(':GoogleAPI Library')
    compile project(':MenuDrawerLibrary')
    compile project(':IOLibrary')
    compile project(':AR Library')
    compile project(':GoogleLicense')
    compile project(':android-maps-utils-library')
}




我确信不知何故我添加了两次google库。

感谢。

1 个答案:

答案 0 :(得分:0)

检查为该模块编译的其他模块。

查看包含依赖项的内容的最佳方法是使用gradlew

请参阅here如何生成依赖项三。

现在你必须看看其他谷歌图书馆所在的三个。