2016-01-21 94 views
6

我一直在嘗試很多解決方案,即使啓用multiDexEnabled爲true,但仍然出現此錯誤意外的頂級錯誤。 這是我的構建意外的頂級錯誤

android { 
compileSdkVersion 22 
buildToolsVersion '22.0.1' 

defaultConfig { 
    applicationId "com.xxx" 
    minSdkVersion 11 
    targetSdkVersion 22 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 

} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
} 

} 

dependencies { 
compile fileTree(include: ['*.jar'], dir: 'libs') 
compile 'com.android.support:appcompat-v7:22.2.1' 
compile 'com.loopj.android:android-async-http:1.4.9' 
compile 'com.google.android.gms:play-services:8.1.0' 
compile 'com.googlecode.libphonenumber:libphonenumber:6.2' 
compile 'com.paypal.sdk:paypal-android-sdk:2.12.4' 
compile 'com.android.support:design:22.2.1' 
compile 'com.google.zxing:core:3.2.0' 
compile 'com.android.support:multidex:1.0.1' 
} 

我收到此錯誤

UNEXPECTED TOP-LEVEL ERROR: 
java.lang.OutOfMemoryError: GC overhead limit exceeded 
    at com.android.dx.rop.code.PlainInsn.withNewRegisters(PlainInsn.java:152) 
    at com.android.dx.ssa.NormalSsaInsn.toRopInsn(NormalSsaInsn.java:126) 
    at com.android.dx.ssa.back.SsaToRop.convertInsns(SsaToRop.java:341) 
    at com.android.dx.ssa.back.SsaToRop.convertBasicBlock(SsaToRop.java:322) 
    at com.android.dx.ssa.back.SsaToRop.convertBasicBlocks(SsaToRop.java:259) 
    at com.android.dx.ssa.back.SsaToRop.convert(SsaToRop.java:123) 
    at com.android.dx.ssa.back.SsaToRop.convertToRopMethod(SsaToRop.java:69) 
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:101) 
    at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72) 
    at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:297) 
    at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137) 
    at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93) 
    at com.android.dx.command.dexer.Main.processClass(Main.java:729) 
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673) 
    at com.android.dx.command.dexer.Main.access$300(Main.java:83) 
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602) 
    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284) 
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166) 
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144) 
    at com.android.dx.command.dexer.Main.processOne(Main.java:632) 
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:505) 
    at com.android.dx.command.dexer.Main.runMultiDex(Main.java:334) 
    at com.android.dx.command.dexer.Main.run(Main.java:244) 
    at com.android.dx.command.dexer.Main.main(Main.java:215) 
    at com.android.dx.command.Main.main(Main.java:106) 


FAILED 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':app:transformClassesWithDexForDebug'. 
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 3 

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

我到底錯在這裏做的,我是一個庫衝突還是我失去了一些東西在這裏

回答

27

這增加你的build.gradle(在你的buildTypes之後)

dexOptions { 
    javaMaxHeapSize "4g" 
} 
+0

看過許多解決方案後,這實際上是什麼失蹤。 :D在此先感謝, – Tuna

+0

它的作用和含義是什麼?任何人 ? –

+0

@JongzPuangput它是一個選項,用於指定JVM dex操作的最大內存分配池(4g意味着4千兆字節) – Bronx