Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React-native 0.60 - Android build release failed - OutOfMemory

Tags:

After upgrading to RN 0.60 - try to run the command:

react-native run-android --variant=release 

Failed with error:

Execution failed for task ':app:packageRelease'. 2 exceptions were raised by workers: java.io.UncheckedIOException: java.io.IOException: Execution of compression failed. java.lang.OutOfMemoryError

The solution for me was:

  1. Adding dexoptions in app build.gradle
android {     dexOptions {         javaMaxHeapSize "4g"     }  } 
  1. Increasing JVM heap size in gradle.properties
org.gradle.jvmargs=-Xmx4608M 
like image 298
Liron Sher Avatar asked Jul 31 '19 06:07

Liron Sher


2 Answers

This solution worked for me.

  1. Adding following in android/app/build.gradle:
android {     ...     dexOptions { javaMaxHeapSize "2g" }     ...     } 
  1. Adding following in android/gradle.properties:

org.gradle.jvmargs=-Xmx4608M

like image 147
Shehzad Osama Avatar answered Oct 10 '22 17:10

Shehzad Osama


The way I solved this issue was

  1. In your ~android/app/build.gradle file add the following line
 android {      ...      dexOptions {         javaMaxHeapSize "4g"      }      ...      } 
  1. In your ~android/gradle.properties add the following line
org.gradle.jvmargs=-Xmx4608m 
like image 39
Lakshan Mamalgaha Avatar answered Oct 10 '22 18:10

Lakshan Mamalgaha