简体   繁体   中英

com.android.dex.DexIndexOverflowException: Error:Execution failed for task “…\Java\jdk1.7.0_17\bin\java.exe” finished with non-zero exit value 2

I updated Android Studio and then started getting this error. here is my dependencies list:

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile files('libs/isoparser-1.0.6.jar')
compile files('libs/aspectjrt-1.7.3.jar')
compile 'com.facebook.android:facebook-android-sdk:4.1.2'
compile 'org.twitter4j:twitter4j-core:4.0.3'
compile 'com.amazonaws:aws-android-sdk-s3:2.2.1'
compile 'com.amazonaws:aws-android-sdk-core:2.2.1'
}

here is console log:

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
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)
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_17\bin\java.exe'' finished with non-zero exit value 2

I searched other questions like this but none of those helped. How do I fix this? Note: I ran same code on Android Studio on my Macbook and code worked fine. The above issue is occurring on my windows where I updated the Android Studio.

compile 'com.google.android.gms:play-services:7.5.0'

Break this up into the modules: https://developers.google.com/android/guides/setup

You have exceeded the dex size limit

Make change in build.gradle

defaultConfig {
        multiDexEnabled true
    }

then it will start working.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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