title: Out of memory error while running gradlew assembleRelease - react-native
body: <p>I am getting this error while making a release build for my react native project:</p>
  <pre><code>Expiring Daemon because JVM heap space is exhausted
      
  &gt; Task :app:transformDexArchiveWithDexMergerForRelease FAILED
  
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':app:transformDexArchiveWithDexMergerForRelease'.
  &gt; java.lang.OutOfMemoryError (no error message)
  </code></pre>
  <p>Done some research and made some changes, which are below:</p>
  <ol>
  <li><p>Added  <code>android:largeHeap=&quot;true&quot;</code> to the application tag in the AndroidManifest.xml</p>
  </li>
  <li><p>Added</p>
  <pre><code>dexOptions {
      javaMaxHeapSize &quot;4g&quot; 
  }
  </code></pre>
  <p>in the android/app/build.gradle file.</p>
  </li>
  <li><p>Added the below code to gradle.properties</p>
  <pre><code>org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=4096m -XX:+HeapDumpOnOutOfMemoryError
  org.gradle.daemon=true
  org.gradle.parallel=true
  org.gradle.configureondemand=true
  </code></pre>
  </li>
  </ol>
  <p>Still I am not able to get rid of this error. Any permanent way to get rid of this error and how is it caused??</p>