title: React Native Signed Apk Crashes Immediately
body: <p>I have a React Native project that works successfully on Emulator. I also install the debug APK to my android phone and it works as expected. But when I create this apk as a signed-apk, It crashes immediately with the </p>
  
  <blockquote>
    <p>xxx Application stopped</p>
  </blockquote>
  
  <p>result.</p>
  
  <p>As the logcat the error occured in index.android.bundle file (setGlobalHandler(function(e,r){try{l.handleException(e,r)}catch(r){throw //console.log('Failed to print error: ',r.message),e})</p>
  
  <pre><code>Here is my package.json file.
  {
    "name": "xxx",
    "version": "0.0.1",
    "private": true,
    "scripts": {
      "start": "node node_modules/react-native/local-cli/cli.js start",
      "test": "jest",
       "react-devtools": "react-devtools",
       "release-android": "cd android &amp;&amp; ./gradlew assembleRelease &amp;&amp; open app/build/outputs/apk/release"
     },
     "dependencies": {
      "accordion-collapse-react-native": "^0.1.6",
      "moment": "^2.21.0",
      "native-base": "2.3.5",
      "react": "16.0.0",
      "react-native": "0.51.0",
      "react-native-collapse-view": "^1.0.0",
      "react-native-communications": "^2.2.1",
      "react-native-device-info": "0.21.2",
      "react-native-document-picker": "^2.2.0",
      "react-native-drawer": "^2.5.1",
      "react-native-google-static-map": "^0.1.11",
      "react-native-htmlview": "^0.12.1",
      "react-native-image-progress": "^1.0.1",
      "react-native-keyboard-aware-scroll-view": "^0.8.0",
      "react-native-maps": "^0.21.0",
      "react-native-modal": "^5.2.0",
      "react-native-modal-dropdown": "^0.6.1",
      "react-native-open-maps": "^0.1.3",
      "react-native-swiper": "^1.5.13",
      "react-native-vector-icons": "4.3.0",
      "react-navigation": "^2.0.4",
      "react-redux": "^5.0.6",
      "redux": "^3.7.2",
      "redux-form": "^7.2.1",
      "redux-saga": "^0.16.0"
    },
    "devDependencies": {
      "babel-jest": "22.0.4",
      "babel-preset-react-native": "4.0.0",
      "jest": "22.0.4",
      "react-test-renderer": "16.0.0"
    },
    "resolutions": {
      "uglify-es": "3.2.2"
    },
    "jest": {
      "preset": "react-native"
    },
     "rnpm": {
      "assets": [
        "./src/assets/fonts/"
      ]
    }
  }
  </code></pre>
  
  <p>And, here is my LogCat</p>
  
  <pre><code>12-21 11:03:03.431 23435-23454/? E/ReactNativeJNI: Got JS Exception: Unexpected token '//console.log('Failed to print error: ',r.message),e}})}u('Promise',function(){return r(62)}),u('regeneratorRuntime',function(){return delete e.regeneratorRuntime,r(67),e.regeneratorRuntime});var c=function(e){u(e,function(){return r(22)[e]})};c('setTimeout'),c('setInterval'),c('setImmediate'),c('clearTimeout'),c('clearInterval'),c('clearImmediate'),c('requestAnimationFrame'),c('cancelAnimationFrame'),c('requestIdleCallback'),c('cancelIdleCallback'),u('XMLHttpRequest',function(){return r(68)}),u('FormData',function(){return r(79)}),u('fetch',function(){return r(80).fetch}),u('Headers',function(){return r(80).Headers}),u('Request',function(){return r(80).Request}),u('Response',function(){return r(80).Response}),u('WebSocket',function(){return r(82)}),u('Blob',function(){return r(83)}),u('URL',function(){return r(90)}),e.alert||(e.alert=function(e){r(91).alert('Alert',''+e)});var s=e.navigator;void 0===s&amp;&amp;(e.navigator=s={}),i(s,'product',function(){return'ReactNative'}),i(s,
  12-21 11:03:03.431 23435-23454/? E/AndroidRuntime: FATAL EXCEPTION: mqt_js
      Process: com.xxx.ppm, PID: 23435
      java.lang.RuntimeException: com.facebook.react.devsupport.JSException: Unexpected token '//console.log('Failed to print error: ',r.message),e}})}u('Promise',function(){return r(62)}),u('regeneratorRuntime',function(){return delete e.regeneratorRuntime,r(67),e.regeneratorRuntime});var c=function(e){u(e,function(){return r(22)[e]})};c('setTimeout'),c('setInterval'),c('setImmediate'),c('clearTimeout'),c('clearInterval'),c('clearImmediate'),c('requestAnimationFrame'),c('cancelAnimationFrame'),c('requestIdleCallback'),c('cancelIdleCallback'),u('XMLHttpRequest',function(){return r(68)}),u('FormData',function(){return r(79)}),u('fetch',function(){return r(80).fetch}),u('Headers',function(){return r(80).Headers}),u('Request',function(){return r(80).Request}),u('Response',function(){return r(80).Response}),u('WebSocket',function(){return r(82)}),u('Blob',function(){return r(83)}),u('URL',function(){return r(90)}),e.alert||(e.alert=function(e){r(91).alert('Alert',''+e)});var s=e.navigator;void 0===s&amp;&amp;(e.navigator=s={}),i(s,'product',function(){return'ReactNative'}),i(s,'geolocation',function(){return r(93)});var f=r(16);f.registerLazyCallableModule('Systrace',function(){return r(19)}),f.registerLazyCallableModule('JSTimers',function(){return r(22)}),f.registerLazyCallableModule('HeapCapture',function(){return r(96)}),f.registerLazyCallableModule('SamplingProfiler',function(){return r(97)}),f.registerLazyCallableModule('RCTLog',function(){return r(98)}),f.registerLazyCallableModule('RCTDeviceEventEmitter',function(){return r(30)}),f.registerLazyCallableModule('RCTNativeAppEventEmitter',function(){return r(99)}),f.registerLazyCallableModule('PerformanceLogger',function(){return r(100)}),e.fetchBundle=function(e,n){var t=r(15).BundleFetcher;if(!t)throw new Error('BundleFetcher is missing');t.fetchBundle(e,function(e){if(e){var r=new Error(e.message);r.code=e.code,n(r)}n(null)})}},55);
      '. Expected expression after 'throw'. (index.android.bundle:57)
          at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:24)
          at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:172)
          at com.facebook.react.bridge.CatalystInstanceImpl.onNativeException(CatalystInstanceImpl.java:499)
          at com.facebook.react.bridge.CatalystInstanceImpl.access$900(CatalystInstanceImpl.java:40)
          at com.facebook.react.bridge.CatalystInstanceImpl$NativeExceptionHandler.handleException(CatalystInstanceImpl.java:515)
          at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:33)
          at android.os.Looper.loop(Looper.java:148)
          at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
          at java.lang.Thread.run(Thread.java:818)
       Caused by: com.facebook.react.devsupport.JSException: Unexpected token '//console.log('Failed to print error: ',r.message),e}})}u('Promise',function(){return r(62)}),u('regeneratorRuntime',function(){return delete e.regeneratorRuntime,r(67),e.regeneratorRuntime});var c=function(e){u(e,function(){return r(22)[e]})};c('setTimeout'),c('setInterval'),c('setImmediate'),c('clearTimeout'),c('clearInterval'),c('clearImmediate'),c('requestAnimationFrame'),c('cancelAnimationFrame'),c('requestIdleCallback'),c('cancelIdleCallback'),u('XMLHttpRequest',function(){return r(68)}),u('FormData',function(){return r(79)}),u('fetch',function(){return r(80).fetch}),u('Headers',function(){return r(80).Headers}),u('Request',function(){return r(80).Request}),u('Response',function(){return r(80).Response}),u('WebSocket',function(){return r(82)}),u('Blob',function(){return r(83)}),u('URL',function(){return r(90)}),e.alert||(e.alert=function(e){r(91).alert('Alert',''+e)});var s=e.navigator;void 0===s&amp;&amp;(e.navigator=s={}),i(s,'product',function(){return'ReactNative'}),i(s,'geolocation',function(){return r(93)});var f=r(16);f.registerLazyCallableModule('Systrace',function(){return r(
  </code></pre>