我一直在尝试许多解决方案,即使启用了multiDexEnabled也是如此,但仍然会出现这个错误意外的顶级错误。 这是我的构建
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.
我在这里做错了什么,我是图书馆冲突还是我在这里错过了什么
答案 0 :(得分:32)
将此添加到build.gradle(在buildTypes之后)
dexOptions {
javaMaxHeapSize "4g"
}