Managed workflow Expo 38 - java.lang.NullPointerException on Android in production

As the title says, the app throws a null exception in production on Android. Using the Expo 38 SDK.

This is the stack trace:

java.lang.NullPointerException:
at com.facebook.react.ReactRootView.setAllowImmediateUIOperationExecution (ReactRootView.java:480)
at com.facebook.react.ReactRootView.onMeasure (ReactRootView.java:130)
at android.view.View.measure (View.java:24730)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
at android.view.View.measure (View.java:24730)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
at android.view.View.measure (View.java:24730)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure (ContentFrameLayout.java:143)
at android.view.View.measure (View.java:24730)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical (LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure (LinearLayout.java:721)
at android.view.View.measure (View.java:24730)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
at android.view.View.measure (View.java:24730)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
at android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical (LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure (LinearLayout.java:721)
at android.view.View.measure (View.java:24730)
at android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:6858)
at android.widget.FrameLayout.onMeasure (FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure (DecorView.java:749)
at android.view.View.measure (View.java:24730)
at android.view.ViewRootImpl.performMeasure (ViewRootImpl.java:3264)
at android.view.ViewRootImpl.measureHierarchy (ViewRootImpl.java:2047)
at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2342)
at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1935)
at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:8023)
at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1163)
at android.view.Choreographer.doCallbacks (Choreographer.java:986)
at android.view.Choreographer.doFrame (Choreographer.java:902)
at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1148)
at android.os.Handler.handleCallback (Handler.java:883)
at android.os.Handler.dispatchMessage (Handler.java:100)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7695)
at java.lang.reflect.Method.invoke (Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:950)

Btw, on a related note, how do you debug this? How to map the Java code in production, to the JS code? I’m looking at Sentry right now, but it seems they don’t support native crash reports either.

Hey @simplelogicplaintext,

Are you able to reproduce this consistently? Can you provide any additional information or patterns you’ve recognized that can help us determine where to begin looking for the root cause. (Such as if this is device/model specific, where in the app/what the app is doing when the null exception occurs, etc)

Cheers,
Adam

I noticed the error in the Google Play Console. I can’t tell where does it happen, as the stack trace is reported in Java. If there is a way to map that to my own js code, I would love to know, but the best thing I’ve found so far is Sentry, and it explicitly states it can’t do that at the moment.

It affects something around 70 devices, these are the most common ones:
Xiaomi MI 9 SE
OnePlus 7T
OnePlus OnePlus6T
Xiaomi Redmi Note 7 Pro

Most of the occurrences are on Android 10, but I believe that’s also the case for most of my users, so not sure how helpful is that.

I can’t reproduce it on my own at all (Samsung A10).

Sorry if that’s too little info, but it’s all I got.

@simplelogicplaintext did you manage to find the root cause. I have the exact same issue.

I could not find why this was happening, but it is possible the issue went away with upgrading to Expo 39.