title: React Native release build for Android crashes on startup
body: <p>I've been running into an issue with my React Native app's release builds. The debug builds work just fine and have no issue. When I generate a release build using <code>gradlew assembleRelase</code></p>
  
  <p>I get an APK and it says build successfull. Then I try to install the app on my device using ADB - no problem. But when it comes to running it the app opens for a split second before crashing.</p>
  
  <p>Using <code>adb logcat</code>, I can see the following two errors being thrown:</p>
  
  <p><strong>1) Error getting Google Registration ID - OneSignal/Google Play services</strong></p>
  
  <pre><code>05-09 13:07:33.387 24726 24778 E OneSignal: Error Getting Google Registration ID
  05-09 13:07:33.387 24726 24778 E OneSignal: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/util/zzs;
  05-09 13:07:33.387 24726 24778 E OneSignal:     at com.google.android.gms.iid.zzaa.zzdr(Unknown Source)
  05-09 13:07:33.387 24726 24778 E OneSignal:     at com.google.android.gms.gcm.GoogleCloudMessaging.zza(Unknown Source)
  05-09 13:07:33.387 24726 24778 E OneSignal:     at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source)
  05-09 13:07:33.387 24726 24778 E OneSignal:     at com.onesignal.PushRegistratorGPS$2.run(PushRegistratorGPS.java:167)
  05-09 13:07:33.387 24726 24778 E OneSignal:     at java.lang.Thread.run(Thread.java:818)
  05-09 13:07:33.387 24726 24778 E OneSignal: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.util.zzs" on path: DexPathList[[zip file "/data/app/com.***.app-1/base.apk"],nativeLibraryDirectories=[/data/app/com.***.app-1/lib/arm, /data/app/com.***.app-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
  05-09 13:07:33.387 24726 24778 E OneSignal:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  05-09 13:07:33.387 24726 24778 E OneSignal:     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  05-09 13:07:33.387 24726 24778 E OneSignal:     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
  05-09 13:07:33.387 24726 24778 E OneSignal:     ... 5 more
  05-09 13:07:33.387 24726 24778 E OneSignal:     Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.common.util.zzs
  05-09 13:07:33.387 24726 24778 E OneSignal:             at java.lang.Class.classForName(Native Method)
  05-09 13:07:33.387 24726 24778 E OneSignal:             at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
  05-09 13:07:33.387 24726 24778 E OneSignal:             at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
  05-09 13:07:33.387 24726 24778 E OneSignal:             at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
  05-09 13:07:33.387 24726 24778 E OneSignal:             ... 6 more
  05-09 13:07:33.387 24726 24778 E OneSignal:     Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
  </code></pre>
  
  <p>To me it seems like the google play services libraries are not being loaded in correctly, but I have added them to my app's <code>build.gradle</code> like so:</p>
  
  <pre><code>dependencies {
      compile fileTree(dir: "libs", include: ["*.jar"])
      compile "com.facebook.react:react-native:+"  // From node_modules
      compile project(path: ':react-native-onesignal')
      compile project(path: ':react-native-fbsdk')
      compile project(path: ':react-native-config')
  
      implementation (project(':react-native-maps')) {
          //Exclude support-v4 module from react-native-maps plugin because a more recent version is pulled in by another dependency
          exclude group: 'com.android.support', module: 'support-v4'
  
          exclude group: 'com.google.android.gms', module: 'play-services-base'
          exclude group: 'com.google.android.gms', module: 'play-services-maps'
      }
  
      compile (project(':react-native-geolocation-service')) {
          exclude group: 'com.google.android.gms', module: 'play-services-location'
      }
  
      compile 'com.google.android.gms:play-services-location:+'
      compile 'com.google.android.gms:play-services-base:+'
      compile 'com.google.android.gms:play-services-maps:+'
  }
  </code></pre>
  
  <p><strong>2) Module AppRegistry is not a registered callable module</strong></p>
  
  <pre><code>05-09 13:07:34.253 24726 24759 E AndroidRuntime: com.facebook.react.common.JavascriptException: Module AppRegistry is not a registered callable module (calling runApplication), stack:
  05-09 13:07:34.253 24726 24759 E AndroidRuntime: value@23:3441
  05-09 13:07:34.253 24726 24759 E AndroidRuntime: &lt;unknown&gt;@23:1067
  05-09 13:07:34.253 24726 24759 E AndroidRuntime: value@23:3009
  05-09 13:07:34.253 24726 24759 E AndroidRuntime: value@23:1039
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:739)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:95)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:152)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
  05-09 13:07:34.253 24726 24759 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:818)
  05-09 13:07:34.255 24726 24759 D AppTracker: App Event: crash
  </code></pre>
  
  <p>Here it seems that it can't find the registered component, however in my index.js I registered the component like so:</p>
  
  <pre><code>AppRegistry.registerComponent('SpotsApp', () =&gt; App);
  </code></pre>
  
  <p>Where <code>App</code> is the actual application component. Inside my build.gradle I point to this file as the entry file:</p>
  
  <pre><code>project.ext.react = [
      entryFile: "index.js"
  ]
  </code></pre>
  
  <p>And inside my <code>MainApplication</code> I set the main module name like so:</p>
  
  <pre><code>@Override
  protected String getJSMainModuleName() {
      return "App";
  }
  </code></pre>
  
  <p>For the first error it seems to me like the google play services are imported correctly and added as dependencies. For the second error I believe I register my component correctly, yet I keep running into these issues with release build. Any help would be greatly appreciated.</p>