android编译满足app:dexDebug OOM

时间:2015-08-02 20:43:36

标签: android

我遇到的问题是app:dexDebug和multiDexEnabled已设置为true 但仍然是OOM .. 纯android工作室,任何想法解决它?感谢

失败:构建因异常而失败。

  • 出了什么问题: 任务':app:dexDebug'。

    执行失败
      

    com.android.ide.common.internal.LoggedErrorException:无法运行命令:       /Volumes/programfile/Android_MAC/android-sdk-macosx/build-tools/22.0.1/dx --dex --no-optimize --multi-dex --main-dex-list / Users / Ymow / project / android /app/build/intermediates/multi-dex/debug/maindexlist.txt --output / Users / Ymow / project / android / app / build / intermediates / dex / debug --input-list = / Users / Ymow / project / Android设备/应用/编译/中间体/ tmp目录/ DEX /调试/ inputList.txt     错误代码:       3     输出:

    UNEXPECTED TOP-LEVEL ERROR:
    java.lang.OutOfMemoryError: GC overhead limit exceeded
        at com.android.dx.rop.code.RopMethod.calcPredecessors(RopMethod.java:173)
        at com.android.dx.rop.code.RopMethod.labelToPredecessors(RopMethod.java:94)
        at com.android.dx.dex.code.RopTranslator.pickOrder(RopTranslator.java:351)
        at com.android.dx.dex.code.RopTranslator.translateAndGetResult(RopTranslator.java:211)
        at com.android.dx.dex.code.RopTranslator.translate(RopTranslator.java:105)
        at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:317)
        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)
    
    • 尝试: 使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。

    建立失败

    总时间:3分40.988秒

1 个答案:

答案 0 :(得分:0)

这有帮助吗?

dexOptions {
    javaMaxHeapSize "2g"
}