title: React Native app crashing when running on Android device
body: <p>I have a React Native app developed, after upgrading from 0.54 to 0.59.1 the app does not run on device anymore due this error:</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ferrometal12/host.exp.exponent.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
            at android.app.ActivityThread.-wrap11(Unknown Source:0)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
            at android.os.Handler.dispatchMessage(Handler.java:106)
            at android.os.Looper.loop(Looper.java:164)
            at android.app.ActivityThread.main(ActivityThread.java:6501)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
         Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
            at host.exp.exponent.ExponentManifest.fetchCachedManifest(ExponentManifest.java:292)
            at host.exp.exponent.AppLoader.start(AppLoader.java:78)
            at host.exp.exponent.experience.DetachActivity.onCreate(DetachActivity.java:88)
            at android.app.Activity.performCreate(Activity.java:7026)
            at android.app.Activity.performCreate(Activity.java:7017)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1215)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856) 
            at android.app.ActivityThread.-wrap11(Unknown Source:0) 
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
            at android.os.Handler.dispatchMessage(Handler.java:106) 
            at android.os.Looper.loop(Looper.java:164) 
            at android.app.ActivityThread.main(ActivityThread.java:6501) 
            at java.lang.reflect.Method.invoke(Native Method) 
            at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) </p>
  </blockquote>
  
  <p>I dont know what happened after upgrade but I am no longer able to run successfully the app, gradle builds successfully and the app is installed but when it comes to open it crashes!</p>
  
  <p>Any idea what am I missing?</p>
  
  <p>My <strong>manifest</strong> file looks like below:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest
    package="host.exp.exponent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"&gt;
  
    &lt;permission
      android:name="com.ferrometal12.permission.C2D_MESSAGE"
      android:protectionLevel="signature"/&gt;
  
    &lt;uses-permission android:name="com.ferrometal12.permission.C2D_MESSAGE" /&gt;
    &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt;
    &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
    &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
    &lt;uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /&gt;
    &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  
    &lt;!-- ADD PERMISSIONS HERE --&gt;
    &lt;!-- BEGIN OPTIONAL PERMISSIONS --&gt;
  &lt;!--  &lt;uses-permission android:name="android.permission.MANAGE_DOCUMENTS" /&gt;--&gt;
    &lt;uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" /&gt;
    &lt;uses-permission android:name="android.permission.READ_PHONE_STATE" /&gt;
  &lt;!--  &lt;uses-permission android:name="android.permission.USE_FINGERPRINT" /&gt;--&gt;
    &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
    &lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" /&gt;
  
    &lt;!-- These require runtime permissions on M --&gt;
    &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
    &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
  &lt;!--  &lt;uses-permission android:name="android.permission.CAMERA" /&gt;--&gt;
  &lt;!--  &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;--&gt;
  &lt;!--  &lt;uses-permission android:name="android.permission.READ_CALENDAR" /&gt;--&gt;
  &lt;!--  &lt;uses-permission android:name="android.permission.WRITE_CALENDAR" /&gt;--&gt;
    &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt;
  &lt;!--  &lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt;--&gt;
    &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  &lt;!--  &lt;uses-permission android:name="android.permission.WRITE_SETTINGS" /&gt;--&gt;
    &lt;!-- END OPTIONAL PERMISSIONS --&gt;
  
    &lt;!-- ADD TEST PERMISSIONS HERE --&gt;
  
    &lt;uses-feature android:glEsVersion="0x00020000" android:required="false" /&gt;
  
    &lt;application
      android:name=".MainApplication"
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:largeHeap="true"&gt;
  
      &lt;activity
        android:name=".LauncherActivity"
        android:exported="true"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"&gt;
        &lt;!-- ADD SHELL SCHEME HERE --&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".experience.ExperienceActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/Theme.Exponent.Light"
        android:windowSoftInputMode="adjustResize"&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".MainActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/Theme.Exponent.Splash"
        android:windowSoftInputMode="adjustResize"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.MAIN"/&gt;
  
          &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
        &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".experience.ShellAppActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:theme="@style/Theme.Exponent.Splash"
        android:windowSoftInputMode="adjustResize"&gt;
        &lt;!-- ADD SHELL INTENT FILTERS HERE --&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".experience.HomeActivity"
        android:label="@string/app_name"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Exponent.Light"&gt;
      &lt;/activity&gt;
  
      &lt;activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/&gt;
      &lt;!-- ADD DEV SETTINGS HERE --&gt;
      &lt;activity android:name="abi26_0_0.com.facebook.react.devsupport.DevSettingsActivity"/&gt;
      &lt;activity android:name="abi25_0_0.com.facebook.react.devsupport.DevSettingsActivity"/&gt;
      &lt;activity android:name="abi24_0_0.com.facebook.react.devsupport.DevSettingsActivity"/&gt;
      &lt;activity android:name="abi23_0_0.com.facebook.react.devsupport.DevSettingsActivity"/&gt;
      &lt;activity android:name="abi22_0_0.com.facebook.react.devsupport.DevSettingsActivity"/&gt;
      &lt;activity android:name="abi21_0_0.com.facebook.react.devsupport.DevSettingsActivity"/&gt;
      &lt;activity android:name="abi20_0_0.com.facebook.react.devsupport.DevSettingsActivity"/&gt;
  
      &lt;activity
        android:name=".ExponentDevActivity"
        android:exported="true"
        android:label="@string/dev_activity_name"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Exponent.Dark"
        android:windowSoftInputMode="adjustPan"&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".oauth.OAuthWebViewActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Exponent.Light"&gt;
      &lt;/activity&gt;
  
      &lt;activity
          android:name="net.openid.appauth.RedirectUriReceiverActivity"
          tools:node="replace"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="android.intent.action.VIEW"/&gt;
          &lt;category android:name="android.intent.category.DEFAULT"/&gt;
          &lt;category android:name="android.intent.category.BROWSABLE"/&gt;
          &lt;data android:scheme="com.ferrometal12" android:path="oauthredirect"
              tools:ignore="AppLinkUrlError" /&gt;
        &lt;/intent-filter&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".oauth.OAuthResultActivity"&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".chrometabs.ChromeTabsManagerActivity"&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".experience.ErrorActivity"
        android:theme="@style/Theme.Exponent.Dark"
        android:screenOrientation="portrait"&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name=".experience.InfoActivity"
        android:screenOrientation="portrait"
        android:theme="@style/Theme.Exponent.Light"&gt;
      &lt;/activity&gt;
  
      &lt;activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"
        tools:replace="android:theme" /&gt;
  
      &lt;activity
        android:name="com.facebook.ads.InterstitialAdActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" /&gt;
  
      &lt;service
        android:name=".ExponentIntentService"
        android:exported="false" /&gt;
  
      &lt;!-- Analytics --&gt;
      &lt;receiver
        android:name="host.exp.exponent.referrer.InstallReferrerReceiver"
        android:exported="true"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="com.android.vending.INSTALL_REFERRER" /&gt;
        &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
      &lt;!--
      This crashes: https://code.google.com/p/analytics-issues/issues/detail?id=667
      TODO: turn it back on when it's fixed
      &lt;service
        android:name="com.google.android.gms.analytics.CampaignTrackingService"
        android:enabled="true"
        android:exported="false" /&gt;--&gt;
  
      &lt;receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
                android:enabled="true"&gt;
        &lt;intent-filter&gt;
          &lt;action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" /&gt;
        &lt;/intent-filter&gt;
      &lt;/receiver&gt;
  
      &lt;service android:name="com.google.android.gms.analytics.AnalyticsService"
               android:enabled="true"
               android:exported="false"/&gt;
  
  
      &lt;!-- ImagePicker native module --&gt;
      &lt;activity
        android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
        android:theme="@style/Base.Theme.AppCompat"&gt;
      &lt;/activity&gt;
  
  
      &lt;!-- ADD FABRIC CONFIG HERE --&gt;
      &lt;!-- BEGIN FABRIC CONFIG --&gt;
      &lt;meta-data
        android:name="io.fabric.ApiKey"
        android:value="a25fafe9f9edee11a9882b32e0cd7a26df6e2c42"/&gt;
      &lt;!-- END FABRIC CONFIG --&gt;
  
      &lt;!-- ADD GOOGLE MAPS CONFIG HERE --&gt;
      &lt;!-- BEGIN GOOGLE MAPS CONFIG --&gt;
      &lt;meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyCPyKmt6in3JwAsogYikNNjor8qgU9stRQ"/&gt;
      &lt;!-- END GOOGLE MAPS CONFIG --&gt;
  
      &lt;!-- ADD BRANCH CONFIG HERE --&gt;
  
      &lt;!-- The Facebook SDK runs FacebookInitProvider on startup and crashes if there isn't an ID here --&gt;
      &lt;meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb0"/&gt;
    &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>MainActivity.java looks as below:</p>
  
  <pre><code>    package host.exp.exponent;
  
  import android.os.Bundle;
  
  import com.facebook.react.ReactPackage;
  
  import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.List;
  
  import host.exp.exponent.generated.DetachBuildConstants;
  import host.exp.exponent.experience.DetachActivity;
  
  public class MainActivity extends DetachActivity {
  
    @Override
    public String publishedUrl() {
      return "exp://exp.host/@lulzimfazlija/ferrometal12";
    }
  
    @Override
    public String developmentUrl() {
      return DetachBuildConstants.DEVELOPMENT_URL;
    }
  
    @Override
    public List&lt;String&gt; sdkVersions() {
      return new ArrayList&lt;&gt;(Arrays.asList("26.0.0"));
    }
  
    @Override
    public List&lt;ReactPackage&gt; reactPackages() {
      return ((MainApplication) getApplication()).getPackages();
    }
  
    @Override
    public boolean isDebug() {
      return BuildConfig.DEBUG;
    }
  
    @Override
    public Bundle initialProps(Bundle expBundle) {
      // Add extra initialProps here
      return expBundle;
    }
  }
  </code></pre>
  
  <p>MainApplication. java looks like:</p>
  
  <pre><code>package host.exp.exponent;
  
  
  import com.facebook.react.ReactPackage;
  
  import java.util.Arrays;
  import java.util.List;
  
  // Needed for `react-native link`
  // import com.facebook.react.ReactApplication;
  
  public class MainApplication extends ExpoApplication {
  
    @Override
    public boolean isDebug() {
      return BuildConfig.DEBUG;
    }
  
    // Needed for `react-native link`
    public List&lt;ReactPackage&gt; getPackages() {
      return Arrays.&lt;ReactPackage&gt;asList(
          // Add your own packages here!
          // TODO: add native modules!
  
          // Needed for `react-native link`
          // new MainReactPackage()
      );
    }
  
    @Override
    public String gcmSenderId() {
      return getString(R.string.gcm_defaultSenderId);
    }
  
    @Override
    public boolean shouldUseInternetKernel() {
      return BuildVariantConstants.USE_INTERNET_KERNEL;
    }
  }
  </code></pre>