Android crash: java.lang.RuntimeException: at android.app.ActivityThread.performResumeActivity

2.9k Views Asked by At

This bug occurred in internal testing (never seen in development) and has been reported so far for only one user, on one device whose specs are:

  • Xiaomi Redmi 6A
  • Android 8.1 (SDK 27)

It's also a ReactNative application built with (some probably relevant packages):

  • "react-native": "~0.63.4",
  • "expo": "^41.0.0",
  • "expo-permissions": "~12.0.1",

Below is the log on GooglePlay Console:

java.lang.RuntimeException: 
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3657)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3697)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1690)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:176)
  at android.app.ActivityThread.main (ActivityThread.java:6662)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)
Caused by: java.lang.NullPointerException: 
  at java.util.Objects.requireNonNull (Objects.java:203)
  at expo.modules.location.LocationModule.handleForegroundLocationPermissions (LocationModule.java:16)
  at expo.modules.location.LocationModule.lambda$requestForegroundPermissionsAsync$2 (LocationModule.java)
  at expo.modules.location.LocationModule.lambda$requestForegroundPermissionsAsync$2$LocationModule (LocationModule.java)
  at expo.modules.location.-$$Lambda$LocationModule$k4oVIWX5Tq-1bJGiv_G_lWYmJ10.onResult (-.java:4)
  at org.unimodules.adapters.react.permissions.PermissionsService$createListenerWithPendingPermissionsRequest$1.onRequestPermissionsResult (PermissionsService.java:32)
  at com.facebook.react.ReactActivityDelegate$2.invoke (ReactActivityDelegate.java:20)
  at com.facebook.react.ReactActivityDelegate.onResume (ReactActivityDelegate.java:12)
  at com.facebook.react.ReactActivity.onResume (ReactActivity.java:5)
  at android.app.Instrumentation.callActivityOnResume (Instrumentation.java:1355)
  at android.app.Activity.performResume (Activity.java:7182)
  at android.app.ActivityThread.performResumeActivity (ActivityThread.java:3632)
  at android.app.ActivityThread.handleResumeActivity (ActivityThread.java:3697)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1690)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:176)
  at android.app.ActivityThread.main (ActivityThread.java:6662)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:547)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:873)

Also below is the app's MainActivity's, if it helps


    // Added automatically by Expo Config
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        Intent intent = new Intent("onConfigurationChanged");
        intent.putExtra("newConfig", newConfig);
        sendBroadcast(intent);
    }

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(null);
    // SplashScreen.show(...) has to be called after super.onCreate(...)
    // Below line is handled by '@expo/configure-splash-screen' command and it's discouraged to modify it manually
    SplashScreen.show(this, SplashScreenImageResizeMode.CONTAIN, ReactRootView.class, false);
  }


    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "main";
    }

    @Override
    protected ReactActivityDelegate createReactActivityDelegate() {
        return new ReactActivityDelegate(this, getMainComponentName()) {
            @Override
            protected ReactRootView createRootView() {
                return new RNGestureHandlerEnabledRootView(MainActivity.this);
            }
        };
    }
}

Any help would be highly appreciated!

I also acknowledge that any use of tools like Crashlytics would make life easier, and they aren't integrated as of now. But I might as well do that if it's the only way it can be resolved, later on.. Thanks!

1

There are 1 best solutions below

0
On

its seems like there is no location permission granted

java.lang.NullPointerException: at java.util.Objects.requireNonNull (Objects.java:203) at expo.modules.location.LocationModule.handleForegroundLocationPermissions (LocationModule.java:16) at expo.modules.location.LocationModule.lambda$requestForegroundPermissionsAsync$2 (LocationModule.java) at expo.modules.location.LocationModule.lambda$requestForegroundPermissionsAsync$2$LocationModule (LocationModule.java)