简体   繁体   English

Android Studio中有多个dex文件?

[英]Multiple dex files in Android Studio?

HI i found this error and for last two days i am playing with error but did not run the project. 您好,我发现了此错误,最近两天我一直在玩错误,但没有运行该项目。 please any one help me. 请任何人帮助我。 i delete the android support v4.jar from main project not delete from libraries project because they have their own dependencies and also delete the anotation jar. 我从主项目中删除android支持v4.jar,而不是从库项目中删除,因为它们具有自己的依赖关系,并且还删除了注解jar。 annotation jar, android support v4, and appcompact v4 is using in External Libraries project. 外部库项目中正在使用批注jar,android支持v4和appcompact v4。 but still i found this issue. 但我仍然发现了这个问题。 this is my jar list 这是我的罐子清单

android-support-v7-recyclerview.jar
AndroidAnimations.jar
AndroidEasingFunctions-1.0.0.jar
google-http-client-1.16.0-rc.jar
google-play-services.jar
gson-2.1.jar

And this is my gradle file 这是我的gradle文件

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2+'
    }
}
apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 21
    buildToolsVersion '21.0.1'

    defaultConfig {
        applicationId "com.iptikarpromotion"
        minSdkVersion 9
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.2.0'
    compile files('libs/android-support-v7-recyclerview.jar')
    compile files('libs/AndroidAnimations.jar')
    compile files('libs/AndroidEasingFunctions-1.0.0.jar')
    compile files('libs/google-http-client-1.16.0-rc.jar')
    compile files('libs/google-play-services.jar')
    compile files('libs/gson-2.1.jar')
    compile project(':libraries:ImageSliderLibrary')
    compile project(':libraries:GalleryViewLibrary')
}

please see this belopw error 请参阅此belopw错误

com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
    at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
    at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
    at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
    at com.android.dx.command.dexer.Main.run(Main.java:245)
    at com.android.dx.command.dexer.Main.main(Main.java:214)
    at com.android.dx.command.Main.main(Main.java:106)
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 2

The class android/support/annotation/AnimRes is included twice in your project, maybe in two different libraries. android / support / annotation / AnimRes类在您的项目中包含两次,也许在两个不同的库中。 You need to find it out what is and exclude one of them. 您需要找出是什么并排除其中之一。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM