java.lang.RuntimeException: Expo encountered a fatal error: TypeError: undefined is not an object (evaluating 's.default.Orientation')

My app is crashing on random android devices with below stack trace reported in google play store:

java.lang.RuntimeException: Expo encountered a fatal error: TypeError: undefined is not an object (evaluating ‘s.default.Orientation’), stack:
1196:1536
v 2:1473
1092:306
v 2:1473
747:543
v 2:1473
6:60
v 2:1473
d 2:875
global code 1278:3

at host.exp.exponent.experience.q.E(BaseExperienceActivity.java
at host.exp.exponent.experience.-$$Lambda$BaseExperienceActivity$zZZNiLUhJmY4AlwF2loJATXcbqc.run (-.java:2)
at android.os.Handler.handleCallback (Handler.java:883)
at android.os.Handler.dispatchMessage (Handler.java:100)
at android.os.Looper.loop (Looper.java:241)
at android.app.ActivityThread.main (ActivityThread.java:7617)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:941)

There is no indication where the issue is. Can someone help to interpret above error to find root cause of the crash?

I am using:

  1. SDK Version: 41
  2. Platforms(Android/iOS/web/all): Android
  3. Error is reported on real device having different Android SDK version and different brand/models

you didn’t share any code so it’s hard to say. but maybe you are not importing screenorientation correctly:

import * as ScreenOrientation from 'expo-screen-orientation';
// ^ this is correct

you might be doing

import ScreenOrientation from 'expo-screen-orientation';
// ^ this is wrong

see docs: https://docs.expo.io/versions/v41.0.0/sdk/screen-orientation/

1 Like

@notbrent Thanks for reply. I did not share the code because I do not know which code is causing the crash. Let me know which code can help find the root cause. I will share it here.

Also, I did not find any references to expo-screen-orientation or ScreenOrientation in my whole project.

Also, note that my app does not support orientation change. Means, it supports only portrait mode. We have mentioned "orientation": "portrait" in app.json.

here is how you can find the root cause: fyi/manual-debugging.md at main · expo/fyi · GitHub

@notbrent Thanks for reply. What I mean by finding the root cause is the line of code in .js file causing the issue same way Java/C# stack trace tells the exact file name and line number causing the exception.

Is there a way to relate .js file (with line number) just by looking at crash report provided from play store?

if it’s caused by javascript then you could possibly use a service like sentry

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.