【问题标题】:How can I get around Android's jack compiler giving Java heap space exceptions?如何绕过 Android 的 jack 编译器给出 Java 堆空间异常?
【发布时间】:2017-03-20 05:41:59
【问题描述】:

我最近尝试添加 Apache Commons 的数学库,但在编译过程中遇到了以下异常:

错误:任务“:app:transformClassesWithPreJackPackagedLibrariesForDebug”执行失败。 com.android.sched.scheduler.RunnerProcessException:在“静态 void org.apache.commons.math3.util.FastMathLiteralArrays.() (FastMathLiteralArrays.java:28-5102)”上的“CodeItemBuilder”运行程序期间出错:Java 堆空间

我认为问题与这些问题中遇到的问题相似:

Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > java.lang.UnsupportedOperationException (no error message)

Android- Error:Execution failed for task ':app:transformClassesWithDexForRelease'

【问题讨论】:

标签: android apache-commons-math jack-compiler


【解决方案1】:

正如异常所述,可用堆空间存在问题。要增加分配给 Jack 编译器的堆空间大小,您必须在进程外运行,然后应用适当的 dex 选项:

defaultConfig {
    jackOptions {
        enabled true
        jackInProcess false
    }
    dexOptions {
        javaMaxHeapSize "2048M"
    }
}

有了这些,我就能克服编译错误。

【讨论】:

    猜你喜欢
    • 2017-04-22
    • 2012-08-01
    • 2017-01-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-18
    • 1970-01-01
    相关资源
    最近更新 更多