react-native: android crash

RN .44, Android is crashing a lot. iOS is fine.

This is the crash report from BugSnag. I have no idea what is happening, or (more importantly) how I can stop these crashes.

Any feedback would be greatly appreciated.

com.facebook.react.uimanager.IllegalViewOperationException Trying to remove a view index above child count 38 view tag: 776
 detail: View tag:776
  children(38): [
15984,777,792,820,834,876,890,905,919,934,948,963,977,1658,1673,1687,
1818,1833,1847,1868,1883,1897,1918,1933,1947,1969,1984,1998,2019,2034,2048,2069,
2084,2098,2119,2134,15998,2148,
 ],
  indicesToRemove(1): [
38,
 ],
  tagsToDelete(1): [
15998,
 ]
 
    NativeViewHierarchyManager.java:345 com.facebook.react.uimanager.NativeViewHierarchyManager.manageChildren
    UIViewOperationQueue.java:179 com.facebook.react.uimanager.UIViewOperationQueue$ManageChildrenOperation.execute
    UIViewOperationQueue.java:787 com.facebook.react.uimanager.UIViewOperationQueue$2.run
    UIViewOperationQueue.java:843 com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches
    UIViewOperationQueue.java:48 com.facebook.react.uimanager.UIViewOperationQueue.access$1600
    UIViewOperationQueue.java:889 com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded
    GuardedFrameCallback.java:31 com.facebook.react.uimanager.GuardedFrameCallback.doFrame
    ReactChoreographer.java:129 com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame
    ChoreographerCompat.java:107 com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame
    Choreographer.java:872 android.view.Choreographer$CallbackRecord.run
    Choreographer.java:686 android.view.Choreographer.doCallbacks
    Choreographer.java:618 android.view.Choreographer.doFrame
    Choreographer.java:860 android.view.Choreographer$FrameDisplayEventReceiver.run
    Handler.java:751 android.os.Handler.handleCallback
    Handler.java:95 android.os.Handler.dispatchMessage
    Looper.java:154 android.os.Looper.loop
    ActivityThread.java:6290 android.app.ActivityThread.main
    Method.java:-2 java.lang.reflect.Method.invoke
    ZygoteInit.java:886 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
    ZygoteInit.java:776 com.android.internal.os.ZygoteInit.main

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 37 (1 by maintainers)

Most upvoted comments

This needs to be re-opened.

I found a workaround for my case. I had lines like these in render:

(this.props.condition && <View><Text>asdf</Text></View>)

And for some reason layout animation cannot remove this View so I just place it with and empty View

(this.props.condition ?
  <View><Text>asdf</Text></View>
  :
  <View></View>
)

it happened with me because I make width:"80" instead of width:80

[Android, RN 0.41.0] The same problem I have encountered. Here are some recent crash reports.

wx20170601-103031 2x

This issue is occurring for me on RN 0.46.3. Over 2000 users have seen this crash in my app. This is <1% of total users, but still very significant. It is rare and I haven’t been able to recreate it in a controlled environment. I am using LayoutAnimation.

@parkerdan Could you please re-open this issue. It has not been resolved. It is good that you found a work-around by not using LayoutAnimation, but this is still a bug that should be addressed, right?

We fixed this same issue by removing experimental layout animations

// UIManager.setLayoutAnimationEnabledExperimental(true);

For me it seams that bumping compileSdkVersion and targetSdkVersion to 26 seams to fix this issue. Unfortunately I needed to revert back to 25 because other issues.

@solartcc 我们也遇到类似的问题,这个问题在我们使用了react-native-navigation这个导航库之后大量出现

com.facebook.react.uimanager.IllegalViewOperationException: Trying to add unknown view tag: 236 at com.facebook.react.uimanager.f._61_a(UIImplementation.java:480) at com.facebook.react.uimanager.UIManagerModule.setChildren(UIManagerModule.java:439) at java.lang.reflect.Method.invoke(Native Method) at com.facebook.react.bridge._61_q._61_a(JavaMethodWrapper.java:374) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:101) at com.facebook.react.bridge.queue._61_a.dispatchMessage(MessageQueueThreadHandler.java:31) at android.os.Looper.loop(Looper.java:166) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194) at java.lang.Thread.run(Thread.java:784)

I am also getting this error on Android in RN 0.51.0. Where do I remove LayoutAnimation from? I’m not using LayoutAnimation in my main codebase, but it’s referenced many, many times in node_modules.

I removed Layout Animation and this stopped.

I am closing this because I know the culprit.

Thank you @stoffern