Build APK: Errors while building APK. You can find the errors in the 'Messages' view

Android 在build和clean的时候正常,但是在buildapk和signedapk 和runAPk的时候出现以下错误

Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:Error converting bytecode to dex:
Cause: java.lang.RuntimeException: Translation has been interrupted
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

在经过无数次百度之后,终于找到一个相似的错误,问题原因是,在构建build.gradle的时候ExecutionException内存不足导致的,

解决办法:在build.gradle里面的Android下面添加,这将增加DEX操作的最大堆大小

  dexOptions {
    javaMaxHeapSize“4G”
}

可参考:[http://www.it1352.com/189062.html]

你可能感兴趣的:(异常处理)