android - 构建 APK 错误 ExecutionException : java. lang.OutOfMemoryError:

标签 android android-gradle-plugin

我正在尝试构建我的应用程序的 APK,但出现了这些错误。有人知道原因吗?请帮我解决问题。

Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space . Please assign more memory to Gradle in the project's gradle.properties file. For example, the following line, in the gradle.properties file, sets the maximum Java heap size to 1,024 MB: <em>org.gradle.jvmargs=-Xmx1024m</em> <a href="http://www.gradle.org/docs/current/userguide/build_environment.html">Read Gradle's configuration guide</a><br><a href="http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html">Read about Java's heap size</a>


Error:Uncaught translation error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded


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

最佳答案

转到grade.properties并为我的Gradle分配更多内存:-

org.gradle.jvmargs=-Xmx2048m

如果崩溃仍然存在,请将其添加到应用程序标记内的 list 中:-

android:largeHeap="true"

关于android - 构建 APK 错误 ExecutionException : java. lang.OutOfMemoryError:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40835668/

相关文章:

Android资源链接失败错误: style attribute 'attr/textColorError (aka com.app.kite:attr/textColorError)' not found

android - 拇指或手指检测机器人

android - android中图像从中心到顶部的翻译

android - Phonegap 显示路径为 'cdvfile://localhost/persistent' 的图像

android - 为什么即使在源代码没有变化的情况下,Android Studio 重建项目的速度如此之慢?

java - 如何为 AndroidX Test 配置 Android 项目

android - 在我的案例中如何膨胀 Activity ?

android - 使用 firemonkey 将照片添加到图库

android - Gradle 插件 : How to convert all images (resources) before APK is packed

intellij-idea - Gradle包含不同父项上的项目