expo: Standalone app crashes after being in the background for a while

Issue (TL;DR): When opening the standalone Android app, if the app was in the background for sometime, it crashes.

Device info: Device: Samsung s8+ (unrooted) Android Version: 7.0

App info: App originally created using CRNA Standalone created using ‘exp build:android’ Uploaded to the play store

Reproduce:

  1. Open the app.
  2. Leave the app using home button (at any screen)
  3. Open the app after a while, usually an hour or so, you see the expo splash screen, after a few seconds the screen moves a little to the left and the app crashes. Opening the app again works well.

Error as logged in the Google dev console:

abi20_0_0.com.facebook.react.uimanager.IllegalViewOperationException: 
  at abi20_0_0.com.facebook.react.uimanager.NativeViewHierarchyManager.resolveViewManager (NativeViewHierarchyManager.java:131)
  at abi20_0_0.com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren (NativeViewHierarchyManager.java:294)
  at abi20_0_0.com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute (UIViewOperationQueue.java:177)
  at abi20_0_0.com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:776)
  at abi20_0_0.com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:855)
  at abi20_0_0.com.facebook.react.uimanager.UIViewOperationQueue.access$1600 (UIViewOperationQueue.java:46)
  at abi20_0_0.com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:813)
  at abi20_0_0.com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:21)
  at android.os.Handler.handleCallback (Handler.java:751)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6776)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)`

package.json:

{
  "name": "pocat",
  "version": "1.3.0",
  "private": true,
  "devDependencies": {
    "react-native-scripts": "1.3.1",
    "jest-expo": "~20.0.0",
    "react-test-renderer": "16.0.0-alpha.12"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "crypto-js": "^3.1.9-1",
    "expo": "^20.1.3",
    "pusher-js": "^4.1.0",
    "qs": "^6.5.0",
    "react": "16.0.0-alpha.12",
    "react-native": "https://github.com/expo/react-native/archive/sdk-20.0.0.tar.gz",
    "react-native-app-link": "^0.4.0",
    "react-native-dotenv": "^0.1.0",
    "react-native-modal": "^3.1.0",
    "react-navigation": "^1.0.0-beta.12"
  }
}

app.json:

{
	"expo": {
		"sdkVersion": "20.0.0",
		"name": "Pocat",
		"slug": "pocat",
		"version": "1.0",
		"icon": "https://s3.amazonaws.com/pokerbuddy/images/app_icon.png",
		"primaryColor": "#bc0000",
		"orientation": "portrait",
		"ios": {
			"bundleIdentifier": "com.hecodesthings.pocat",
			"buildNumber": "2"
		},
		"android": {
			"package": "com.hecodesthings.pocat",
			"versionCode": 2
		},
		"scheme": "pocat",
		"facebookScheme": "fb309462139518578"
	}
}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 2
  • Comments: 33 (11 by maintainers)

Most upvoted comments

Hi everyone! After poking around, it looks like at least one cause of this bug in upstream React Native will be fixed when we release support for RN 0.49 (in SDK 22). Stay tuned for that announcement and please post back if you’re still seeing after upgrading.

@EsdrasEtrenne I was facing a similar issue, after looking up the problem it seems like the views are being removed from the native view hierarchy as an optimization, therefore to make sure that the view is present in the view hierarchy set the prop collapsable to false - in my case in the root view -. collapsable={false} Reference http://facebook.github.io/react-native/releases/0.49/docs/viewproptypes.html#collapsable

I’m getting the same crash in production with my app. Lots of them

In the last 7 days

126 crashes

abi21_0_0.com.facebook.react.uimanager.IllegalViewOperationException: 
  at abi21_0_0.com.facebook.react.uimanager.NativeViewHierarchyManager.resolveViewManager (NativeViewHierarchyManager.java:109)
  at abi21_0_0.com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren (NativeViewHierarchyManager.java:265)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute (UIViewOperationQueue.java:177)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:776)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:855)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue.access$1600 (UIViewOperationQueue.java:46)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:813)
  at abi21_0_0.com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:21)
  at android.os.Handler.handleCallback (Handler.java:751)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6688)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1468)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1358)
106 crashes

abi21_0_0.com.facebook.react.uimanager.IllegalViewOperationException: Trying to add unknown view tag: 32
detail: View tag:12
children(1): [
15,
],
viewsToAdd(1): [
[1,32],
],
at abi21_0_0.com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute (UIViewOperationQueue.java:177)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:776)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:855)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue.access$1600 (UIViewOperationQueue.java:46)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java:900)
  at abi21_0_0.com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java:31)
  at abi21_0_0.com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java:136)
  at abi21_0_0.com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java:107)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:869)
  at android.view.Choreographer.doCallbacks (Choreographer.java:683)
  at android.view.Choreographer.doFrame (Choreographer.java:616)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:857)
  at android.os.Handler.handleCallback (Handler.java:751)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6247)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:872)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:762)

and

94 crashes

abi21_0_0.com.facebook.react.uimanager.IllegalViewOperationException: Trying to add unknown view tag: 26
detail: View tag:15
children(2): [
20,24,
],
viewsToAdd(1): [
[2,26],
],
at abi21_0_0.com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren(NativeViewHierarchyManager.java
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute (UIViewOperationQueue.java:177)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:776)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:855)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue.access$1600 (UIViewOperationQueue.java:46)
  at abi21_0_0.com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:813)
  at abi21_0_0.com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:21)
  at android.os.Handler.handleCallback (Handler.java:751)
  at android.os.Handler.dispatchMessage (Handler.java:95)
  at android.os.Looper.loop (Looper.java:154)
  at android.app.ActivityThread.main (ActivityThread.java:6682)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)

App crashing upon opening or crashing when the app is put in the background for a while…

Dependencies:

"@bam.tech/react-native-root-siblings": "^1.2.1",
    "@expo/ex-navigation": "~3.0.0",
    "deepmerge": "^1.3.2",
    "expo": "^21.0.0",
    "immutable": "^3.8.1",
    "lodash.debounce": "^4.0.8",
    "moment": "^2.18.1",
    "moment-duration-format": "^1.3.0",
    "moment-timezone": "^0.5.13",
    "react": "16.0.0-alpha.12",
    "react-native": "https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz",
    "react-native-animatable": "^1.2.4",
    "react-native-autocomplete-input": "3.1.0",
    "react-native-autolink": "^1.0.0",
    "react-native-flip-card": "3.4.1",
    "react-native-i18n": "^1.0.0",
    "react-native-swipeable": "^0.6.0",
    "react-native-swiper": "^1.5.10",
    "react-native-vector-icons": "^4.0.1",
    "react-redux": "^5.0.4",
    "redux": "^3.6.0",
    "redux-mock-store": "^1.2.3",
    "redux-thunk": "^2.2.0",
    "reselect": "^3.0.0",
    "sentry-expo": "^1.6.0"

I started getting this issue when I update from expo 15.0.0 to 20.0.0 (and from react 0.42.3 to “react-native”: “https://github.com/expo/react-native/archive/sdk-20.0.0.tar.gz”)

I only have a very few users (currently 9) on android so I don’t know how much this can say. Maybe it’s something that is caused bc of the app installed together with the expo client on the same device? Weird that only the developers get this. But if it’s like that, then I’m less worried actually.

Im having this issue a ton lately too and I have no clue where it’s coming from. There is no real details to the error and not a ton of documentation on it