title: bundleReleaseJsAndAssets during Android release builds is taking infinite time
body: <p>I am a UI developer and new to android, gradle and trying to figure out why to debug build ran fine and release build did not. Also, how can figure out this issue. 
  I upgraded a legacy android app which included react native upgrade from v0.36.0 to 0.58.0 and trying to build the same</p>
  
  <ul>
  <li>The debug build runs fine</li>
  <li>The react-native command runs fine
  react-native bundle --platform android --entry-file index.android.js --bundle-output xyz/index.android.bundle --assets-dest xyz/ --dev false</li>
  </ul>
  
  <p>but when I try to run ./gradlew bundleReleaseJsAndAssets --debug
  it runs for an infinite time.
  I am using MAC, gradle 4.7</p>
  
  <p>Tried project.ext.react = [ extraPackagerArgs: ["--max-workers=1"] ]
  Tried org.gradle.configureondemand=true since I am manually able to bundle. 
  Tried solution from following links</p>
  
  <p><a href="https://proandroiddev.com/bundling-react-native-during-android-release-builds-ec52c24e200d" rel="nofollow noreferrer">https://proandroiddev.com/bundling-react-native-during-android-release-builds-ec52c24e200d</a></p>
  
  <p><a href="https://github.com/facebook/react-native/issues/11696" rel="nofollow noreferrer">https://github.com/facebook/react-native/issues/11696</a></p>
  
  <p><a href="https://github.com/facebook/react-native/issues/10078" rel="nofollow noreferrer">https://github.com/facebook/react-native/issues/10078</a></p>
  
  <pre><code>[org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
  21:25:28.941 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
  21:25:28.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
  21:25:28.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
  21:25:28.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
  21:25:28.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
  21:25:29.241 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 17179869184, Free: 6562177024}
  21:25:29.242 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 17179869184, Free: 6562177024}
  21:25:29.242 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 954728448, Committed: 671088640}
  21:25:34.240 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting OS memory status event {Total: 17179869184, Free: 6569676800}
  21:25:34.240 [DEBUG] [org.gradle.launcher.daemon.server.health.LowMemoryDaemonExpirationStrategy] Received memory status update: {Total: 17179869184, Free: 6569676800}
  21:25:34.240 [DEBUG] [org.gradle.process.internal.health.memory.MemoryManager] Emitting JVM memory status event {Maximum: 954728448, Committed: 681574400}
  21:25:38.941 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] DaemonExpirationPeriodicCheck running
  21:25:38.941 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
  21:25:38.941 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
  21:25:38.941 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
  21:25:38.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.
  21:25:38.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry.
  21:25:38.942 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
  </code></pre>
  
  <p>If it helps, below is the result of ps -ef | grep "gradle"</p>
  
  <pre><code>-Dfile.encoding=UTF-8 -Duser.country=IN -Duser.language=en -Duser.variant -cp /Users/x.y/.gradle/wrapper/dists/gradle-4.10.1-all/455itskqi2qtf0v2sja68alqd/gradle-4.10.1/lib/gradle-launcher-4.10.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.10.1
  2029432261 16668 16658   0  9:24PM ??         3:48.65 /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -XX:+HeapDumpOnOutOfMemoryError -Xmx1024m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -cp /Users/x.y/.gradle/wrapper/dists/gradle-4.10.1-all/25vec0eimrsoqjasnun8prrj45/gradle-4.10.1/lib/gradle-launcher-4.10.1.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 4.10.1
  2029432261 16658  1910   0  9:24PM ttys001    0:14.87 /usr/bin/java -Xdock:name=Gradle -Xdock:icon=/Users/x.y/Dev/Mobile/myapp-android/media/gradle.icns -Dorg.gradle.appname=gradlew -classpath /Users/x.y/Dev/Mobile/myapp-android/gradle/wrapper/gradle-wrapper.jar org.gradle.wrapper.GradleWrapperMain clean assembleRelease --debug
  </code></pre>