欢迎来到 Android人的问与答 ,在这里提问或帮助他人解答。 Question2Answer的1.6.x和1.7.x版本的中文翻译包我修改更新:

Question2answer

如何使用中文语言包

Q2A 1.6.x - Chinese Simplified (简体中文)

Q2A 1.7.x - Chinese Simplified (简体中文)


国内服务器推荐 阿里云服务器
国外服务器推荐 DigitalOcean
VPN推荐 正版Green VPN
阿里云推荐码:ldvq50

Android Studio2.0遇到Error:java.lang.OutOfMemoryError: GC overhead limit exceeded

0 喜欢 0 不喜欢
2,192 浏览
如果Android Studio编译或运行遇到下面错误:
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner class.
Error:UNEXPECTED TOP-LEVEL ERROR:
Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error: at com.android.dx.ssa.SetFactory.makeLivenessSet(SetFactory.java:91)
Error: at com.android.dx.ssa.SsaBasicBlock.addLiveIn(SsaBasicBlock.java:806)
Error: at com.android.dx.ssa.back.LivenessAnalyzer.liveInAtStatement(LivenessAnalyzer.java:218)
Error: at com.android.dx.ssa.back.LivenessAnalyzer.handleTailRecursion(LivenessAnalyzer.java:131)
Error: at com.android.dx.ssa.back.LivenessAnalyzer.run(LivenessAnalyzer.java:188)
Error: at com.android.dx.ssa.back.LivenessAnalyzer.constructInterferenceGraph(LivenessAnalyzer.java:93)
Error: at com.android.dx.ssa.back.SsaToRop.<init>(SsaToRop.java:82)
Error: at com.android.dx.ssa.back.SsaToRop.convertToRopMethod(SsaToRop.java:69)
Error: at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:101)
Error: at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:72)
Error: at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:297)
Error: at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:137)
Error: at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:93)
Error: at com.android.dx.command.dexer.Main.processClass(Main.java:729)
Error: at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
Error: at com.android.dx.command.dexer.Main.access$300(Main.java:82)
Error: at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)
Error: at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
Error: at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
Error: at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
Error: at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
Error: at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
Error: at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
Error: at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
Error: at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
Error:Execution failed for task ':trunk:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java'' finished with non-zero exit value 3
Information:BUILD FAILED
 
解决方法:
在build.gradle中添加:

dexOptions {

     incremental true

    javaMaxHeapSize "4g"

}

如果添加了不好使,那么修改 'gradle.properties' :

org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

还有关闭选项也可以试试:-XX:-UseGCOverheadLimit

参考:

http://stackoverflow.com/questions/27164452/how-to-solve-java-lang-outofmemoryerror-gc-overhead-limit-exceeded-error-in-and

https://code.google.com/p/android/issues/detail?id=197231

http://stackoverflow.com/questions/27367071/android-studio-1-0-failing-build-at-dexdebug-or-dexrelease

最新提问 4月 11, 2016 分类:Android Studio | 用户: forlong401 (7,050 分)

登录 或者 注册 后回答这个问题。

...