Java Heap Error on ionic build android


#1

“ionic build android” shows this error. What do I need to do to solve this?

:packageDebug
Exception in thread “pool-3-thread-3” java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:3236)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
at java.util.zip.DeflaterOutputStream.deflate(DeflaterOutputStream.java:253)
at java.util.zip.DeflaterOutputStream.write(DeflaterOutputStream.java:211)
at java.io.FilterOutputStream.write(FilterOutputStream.java:97)
at com.android.builder.internal.packaging.zip.compress.DeflateExecutionCompressor.immediateCompress(DeflateExecutionCompressor.java:70)
at com.android.builder.internal.packaging.zip.compress.ExecutorCompressor.lambda$compress$0(ExecutorCompressor.java:55)
at com.android.builder.internal.packaging.zip.compress.ExecutorCompressor$$Lambda$185/254880625.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:748)

UPDATE:
I’ve tried updating the “DEFAULT_JVM_OPTS” under platform/android/gradlew but still the error persists. I don’t know whats wrong.