expo: Apps sometimes crash (call stack at BaseExperienceActivity$2.run)

after the battery bug i released a new android app. But I still see some crashes:

SDK: 35

java.lang.RuntimeException: 
  at host.exp.exponent.experience.BaseExperienceActivity$2.run (BaseExperienceActivity.java:196)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7076)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)

Devices: Galaxy A50 (a50) android 9 Galaxy A40 (a40) android 9

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 66 (30 by maintainers)

Most upvoted comments

at SDK 36 same

I’ve put the code here

Please let me know if you have improvements 😃

I wanted to check for updates periodically. I originally tried using setInterval() but found out that’s not a good idea when you’re trying to do something every 6 hours.

The tick, setTick() stuff in my code is a workaround for that. So every time the user clicks on a button to navigate to another screen the app checks if enough time has passed since the last update check. If so, it updates tick which causes the useEffect() body to run again, which causes it to check for updates.

So this is all a bit convoluted and I’m sure there’s a better way.

This looks like an incomplete OTA update. I experienced that too and was also able to reproduce the problem by opening and closing the app several times while it was auto-downloading an update until I was able to catch it in the middle of a download.

I tried @cruzach’s suggestions here:

#5839 (comment)

After that I have not been able to reproduce the bug.

@wodin, would you mind posting your complete fix? I assume that you implemented it in App.js? Thanks

I also have this issue:

java.lang.RuntimeException: 
  at host.exp.exponent.experience.a$b.run (BaseExperienceActivity.java:7)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:6986)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1445)

Only android device : Samsung Galaxy S9 (starlte), Android 9, Huawei P20 (HWEML), Android 9

My package.json

"dependencies": {
    "expo": "36.0.2",
    "expo-constants": "8.0.0",
    "expo-file-system": "8.0.0",
    "expo-image-picker": "8.0.1",
    "expo-keep-awake": "8.0.0",
    "expo-linear-gradient": "8.0.0",
    "expo-mail-composer": "8.0.0",
    "expo-media-library": "8.0.0",
    "expo-permissions": "8.0.0",
    "expo-sensors": "8.0.0",
    "humps": "2.0.1",
    "prop-types": "15.7.2",
    "react": "16.9.0",
    "react-dom": "16.9.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz",
...

app.json not use userInterfaceStyle

{
  "expo": {
    "name": "...",
    "slug": "...",
    "privacy": "public",
    "sdkVersion": "36.0.0",
    "platforms": [
      "ios",
      "android",
      "web"
    ],

Does anyone have same issue?

Bear in mind that the title of this issue is very non-specific, so a truncated/corrupted bundle would be just one cause of this BaseExperienceActivity$2.run error.

That said, the Updates module is being extracted so that it can be used in the Bare workflow. I think it’s supposed to be released with SDK 37 at the end of March.

I can’t find the issue or the pull request now, though 😅 Ah, here’s the “umbrella” issue for these updates. There are a few different issues/PRs for the Updates module extraction and the Android one is still in progress by the looks of things. https://github.com/expo/expo/issues/6513 https://github.com/expo/expo/pull/6625

Perhaps you can try it out and test how it behaves if you deliberately truncate the bundle. I was able to reproduce the crashes in a managed app like this:

$ expo export --public-url https://example.com/blah/
$ rsync -avxz --progress --delete --stats dist/ example.com:/blah/
$ rm -r dist
$ expo ba --public-url https://example.com/blah/android-index.json
$ expo export --public-url https://example.com/blah/
[Manually truncate dist/bundles/android-*.js] 
$ rsync -avxz --progress --delete --stats dist/ example.com:/blah/

@cruzach and @ide, is there a plan to include fixing this in an upcoming release of ExpoKit? It seems to have been narrowed down to a problem with OTA updates being incomplete on Android and then getting into an unrecoverable state. Thanks for looking into this.

Any news ?

Error while updating property ‘fontSize’ in shadow node of type: RCTText

@liogate I think you might be running into the dark mode issue

EDIT: Sorry, I see you already linked to that issue in your comment 😃

Same problem here on SDK 35 and SDK 36

image (From google play crash screen)

I don’t know what I can do.

I’m not sure, hard to say how to fix without knowing what’s causing the crashes

Is it after a certain OTA update? Or is the binary you’re shipping causing crashes without ever downloading a new javascript bundle?

I’m not sure, I pushed OTA updates, so I don’t know if it happen specifically for OTA updates. I’m using expo ejected (with expokit). I have the issue since SDK 35, currently I’m in SDK 36 and the issue persist.

@Xrew I suggest running your app locally in production mode with expo start --no-dev --minify, that may help you find out what is causing your app to crash