react-native: App crashes randomly on Android 12 with `JSApplicationIllegalArgumentException: Animated node with tag ### does not exists`

Description

com.facebook.react.bridge.JSApplicationIllegalArgumentException: Animated node with tag 201 does not exists at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes(NativeAnimatedNodesManager.java:317) at com.facebook.react.animated.NativeAnimatedModule$15.execute(NativeAnimatedModule.java:681) at com.facebook.react.animated.NativeAnimatedModule.executeAllOperations(NativeAnimatedModule.java:258) at com.facebook.react.animated.NativeAnimatedModule.access$400(NativeAnimatedModule.java:85) at com.facebook.react.animated.NativeAnimatedModule$3.execute(NativeAnimatedModule.java:287) at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(UIViewOperationQueue.java:573) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:908) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1019) at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1079) at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29) at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175) at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1140) at android.view.Choreographer.doCallbacks(Choreographer.java:946) at android.view.Choreographer.doFrame(Choreographer.java:870) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1127) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8085) at java.lang.reflect.Method.invoke(Method.java:-2) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

Version

0.64.2

Output of npx react-native info

System: OS: macOS 11.4 CPU: (4) x64 Intel® Core™ i5-7360U CPU @ 2.30GHz Memory: 65.65 MB / 8.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.10.0 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.24.0 - /usr/local/bin/npm Watchman: 2021.09.13.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3 Android SDK: API Levels: 23, 25, 27, 28, 29, 30 Build Tools: 28.0.3, 29.0.2, 30.0.2 System Images: android-29 | Intel x86 Atom_64 Android NDK: 22.1.7171670 IDEs: Android Studio: 4.2 AI-202.7660.26.42.7351085 Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild Languages: Java: 1.8.0_292 - /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.1 => 17.0.1 react-native: 0.64.2 => 0.64.2 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

App crashes randomly in Android

Snack, code example, screenshot, or link to a repository

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 35
  • Comments: 156 (19 by maintainers)

Commits related to this issue

Most upvoted comments

@coolguy001tv Thanks for the context. You’re correct, that’s a valid bug. After some investigation, we realized that this bug seems to happen ONLY on Android 12 and mostly on Samsung devices.

We still haven’t figured out what is the root cause, but the fix for it should be this: https://github.com/facebook/react-native/commit/b347c3949f40b33df300a31ab7f86df4d82a00b2

Sadly, this commit hasn’t been released yet and won’t be available before React Native 0.69.x. In that version you should be able to execute the extra logic with:

ReactFeatureFlags.enableSynchronizationForAnimated = true

In your Application onCreate section.

@ShikaSD also has more context on this. We’re actively monitoring this bug, and we’ll come back with more context if we do further discoveries.

I’am getting this error too!

I created a repo with a simple app as example: https://github.com/jefersonvinicius/react-native-crashing-example

Some extra information:

  • At least with me, the error just happens in release apk. The app works perfectly in debug mode.
  • The error is happening in an Android 12 device, a Galaxy S10 SM-G973F. I tried replicate the error in Android 9 but no error is threw.
  • I don’t know if is related, but I realize the crash happens often when I’am scrolling.

@cortinico sorry to disturb, but can you help us to solve this bug in android 12? It bothers us a lot in such a long time and there’s still no one can offer deeper help.

Maybe there are unknown issue or not of modifying code privately, so waiting for the official solution is way now.

Just a heads up that RN 0.69.0-rc0 is out. While not stable, it’s still worth giving a try as it includes the flags to toggle this behavior

The solutions above do not work for us either. But we found a workaround for our app.

First, which version do we use;

  • react-native 0.67.4
  • react-navigation 5.x
  • react-native-screens 3.6.0

On android side we changed over 15 stacks to native stack with createNativeStackNavigator from react-native-screens/native-stack

const Stack = isIOS ? createStackNavigator() : createNativeStackNavigator();

After this change random crashes stopped. Might work for you.

You can try this way in android/app/build.gradle

add this

dependencies { … implementation “androidx.work:work-runtime-ktx:2.7.0” }

HI @cortinico @ShikaSD , Seems like RN 0.69 is not fixing this issue as well and a significant amount of users are getting affected,Please suggest a version that we can downgrade to avoid this, And also since it’s a P0 issue happening in the latest versions at least from 0.66 onwards , request the team to look into it , any fix or suggestion would be appreciated.

please open .>> node module/react native /react android /src/main/java/react/animated/NativeAnimatedNodesManager

this is code which was affect our app ,please commet all this class or put in (try or catch) error …its working fine for me in all release as well as testing build …

@UiThread public void connectAnimatedNodes(int parentNodeTag, int childNodeTag) { AnimatedNode parentNode = mAnimatedNodes.get(parentNodeTag); try{ if (parentNode == null) { throw new JSApplicationIllegalArgumentException( “connectAnimatedNodes: Animated node with tag (parent) [” + parentNodeTag + “] does not exist”); } AnimatedNode childNode = mAnimatedNodes.get(childNodeTag); if (childNode == null) { throw new JSApplicationIllegalArgumentException( “connectAnimatedNodes: Animated node with tag (child) [” + childNodeTag + “] does not exist”); } parentNode.addChild(childNode); mUpdatedNodes.put(childNodeTag, childNode); }catch(JSApplicationCausedNativeException e){ } }

This issue is quite critical for our userbase. In general, people started to update their phones to Android 12 so this means that more and more users will have the crash. Are there any temporary workarounds? If so, we would be able to patch our RN locally.

cc @ShikaSD @cortinico

@cortinico sorry to disturb, but can you help us to solve this bug in android 12? It bothers us a lot in such a long time and there’s still no one can offer deeper help.

Sorry we can’t help you here. The versions of RN you’re using is too old (we’re at 0.67 and about to release 0.68). If this issue is still happening on 0.67/0.68 AND we have a valid reproducer -> Then we can look into it.

@cortinico There may be too much discussion here which makes you think the RN is too old. Let me sum up: we found this bug in at least those versions: 0.64.2(tested by LiuIos) 0.66(CaioQuirinoMedeiros) 0.67.1(Me) 0.67.3 (zhuanghongji). It crashed randomly in Android 12 only. I myself can reproduct this crash with the example https://github.com/facebook/react-native/issues/33375#issuecomment-1059844263 in 0.67.1, and as https://github.com/facebook/react-native/issues/33375#issuecomment-1059844263 said, this crash happened often when scrolling. In my testing, I heavily scroll and click and navigate back in and out. In both debug and release apk, it will crash, though, it seems in release apk the crash will be a little easier to reproduct.

@mikehardy facing this issue in production

Exception com.facebook.react.bridge.JSApplicationIllegalArgumentException:
  at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes (NativeAnimatedNodesManager.java)
  at com.facebook.react.animated.NativeAnimatedModule$15.execute (NativeAnimatedModule.java)
  at com.facebook.react.animated.NativeAnimatedModule.executeAllOperations (NativeAnimatedModule.java)
  at com.facebook.react.animated.NativeAnimatedModule.access$400 (NativeAnimatedModule.java)
  at com.facebook.react.animated.NativeAnimatedModule$3.execute (NativeAnimatedModule.java)
  at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute (UIViewOperationQueue.java)
  at com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java)
  at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java)
  at com.facebook.react.uimanager.UIViewOperationQueue.access$2600 (UIViewOperationQueue.java)
  at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded (UIViewOperationQueue.java)
  at com.facebook.react.uimanager.GuardedFrameCallback.doFrame (GuardedFrameCallback.java)
  at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame (ReactChoreographer.java)
  at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame (ChoreographerCompat.java)
  at android.view.Choreographer$CallbackRecord.run (Choreographer.java:1106)
  at android.view.Choreographer.doCallbacks (Choreographer.java:866)
  at android.view.Choreographer.doFrame (Choreographer.java:792)
  at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:1092)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8680)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:567)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)

@coolguy001tv Thanks for the context. You’re correct, that’s a valid bug. After some investigation, we realized that this bug seems to happen ONLY on Android 12 and mostly on Samsung devices.

We still haven’t figured out what is the root cause, but the fix for it should be this: b347c39

Sadly, this commit hasn’t been released yet and won’t be available before React Native 0.69.x. In that version you should be able to execute the extra logic with:

ReactFeatureFlags.enableSynchronizationForAnimated = true

In your Application onCreate section.

@ShikaSD also has more context on this. We’re actively monitoring this bug, and we’ll come back with more context if we do further discoveries.

I’am already trying the solution that cortinico mentioned above with:

  • react-native: 0.69.1
  • add ReactFeatureFlags.enableSynchronizationForAnimated = true in MainApplication.onCreate

It just need sometime (not sure how long it is) to verify if it works or not.

I have asked RN team to check this issue in 0.69 patch stream thread. Maybe they will be able to check it.

And the response there is pretty clearly: no reproduction no fix

Interested parties here must produce a reproduction

I propose the possible path forward of users interested here using the Samsung test lab to try for a reproduction.

There is no magic, there is no “someone will show up and help you” bugfix gnomes that are going to show up and do the work here unfortunately because none of those people have a good reproduction. Someone here needs to conclusively reproduce this somehow so that fixes may be tested and implemented.

Expectations embedded in statements like “there must be a fix” and “maybe they will be able to check it” are incorrect expectations which is I am going on and on about it. The expectation should be: I am affected by this, and it is important to me, so I will do everything I can to move it forward. Alternatively the expectation should be “I have not done anything but comment, so I expect nothing will happen here”. I’m just trying to be realistic since that’s how things go without reproductions

Meeting the same crash randomly at version both 0.64.2 and 0.67.3

First i think the point is useNativeDriver: true, so i try to set all useNativeDriver to false, but the crash still exits.

facing the same issue, the app is crashing on android 12 randomaly.

Is there any other workaround instead of building RN from source or upgrading to v0.69?

An example crash log:

Android Version:12 Samsung SM-A135F Model:SP1A.210812.016 “react-native”: “0.68.2”

Screenshot 2022-05-27 at 15 22 23

Looked at Sentry logs of my RN app on production.

Here are the list of device models on which this crash is happening.

[ 'SM-G970F', 'SM-N970F', 'SM-F700F', 'SM-G990E', 'SM-G988B', 'SM-S908E', 'SM-G991B', 'SM-G780F', 'SM-A725F', 'SM-G996B', 'SM-G975F', 'SM-G980F', 'SM-G770F', 'SM-N770F', 'SM-G973F', 'SM-G985F', 'SM-N975F', 'SM-N980F', 'SM-A528B', 'SM-A525F', 'SM-F711B', 'SM-G998B', 'SM-G781B', 'SM-N986B' ]

Hope this helps. For now disabling animation on these devices.

All of them are on Android 12.

Any progress?

Don’t tag me haha, I don’t suffer this crash and I’m travelling. I’ve only been trying to set appropriate expectations since it was tagged in to the release discussion. Those expectations should be that if you are affected you’ve got to produce a reproduction others can run and a PR is worth more than a reproduction. Standard expectations really but somehow not widely understood 🤷

Hi @mikehardy , of course it was not a there must be a fix, but maybe RN team will be able to check the issue. We will try to prepare a reproducible application with this issue. Thank you for your help.

Samsung has a remote device test lab that allows use of real devices, may be an option. Development of some sort of auto test (with detox maybe) that triggered it there should be a top priority. No repro usually means no progress

Today i find out another IllegalArgumentException crash and it is also only happen on Android 12 level 31, detail crash log below:

# main(2)
java.lang.IllegalArgumentException
Invalid parent node provided

com.facebook.react.animated.InterpolationAnimatedNode.onDetachedFromNode(InterpolationAnimatedNode.java:205)
com.facebook.react.animated.AnimatedNode.removeChild(AnimatedNode.java:39)
com.facebook.react.animated.NativeAnimatedNodesManager.disconnectAnimatedNodes(NativeAnimatedNodesManager.java:340)
com.facebook.react.animated.NativeAnimatedModule$16.execute(NativeAnimatedModule.java:709)
com.facebook.react.animated.NativeAnimatedModule.executeAllOperations(NativeAnimatedModule.java:258)
com.facebook.react.animated.NativeAnimatedModule.access$400(NativeAnimatedModule.java:85)
com.facebook.react.animated.NativeAnimatedModule$3.execute(NativeAnimatedModule.java:287)
com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(UIViewOperationQueue.java:573)
com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:908)
com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1019)
com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1079)
com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
android.view.Choreographer$CallbackRecord.run(Choreographer.java:1156)
android.view.Choreographer.doCallbacks(Choreographer.java:948)
android.view.Choreographer.doFrame(Choreographer.java:872)
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1140)
android.os.Handler.handleCallback(Handler.java:938)
android.os.Handler.dispatchMessage(Handler.java:99)
android.os.Looper.loopOnce(Looper.java:210)
android.os.Looper.loop(Looper.java:299)
android.app.ActivityThread.main(ActivityThread.java:8188)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

Maybe between the two crash have some relationship.

react-native: 0.64.2

Can somebody help? I get nearly mad…

the app is crashing on android 12 randomaly.

com.facebook.react.bridge.JSApplicationIllegalArgumentException: connectAnimatedNodes: Animated node with tag (child) [290] does not exist at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes(:5) at com.facebook.react.animated.NativeAnimatedModule$15.execute(:1) at com.facebook.react.animated.NativeAnimatedModule.executeAllOperations(:5) at com.facebook.react.animated.NativeAnimatedModule.access$400(:1) at com.facebook.react.animated.NativeAnimatedModule$3.execute(:1) at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(:1) at com.facebook.react.uimanager.UIViewOperationQueue$1.run(:19) at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(:10) at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(:1) at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(:6) at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(:1) at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(:7) at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(:1) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1184) at android.view.Choreographer.doCallbacks(Choreographer.java:986) at android.view.Choreographer.doFrame(Choreographer.java:907) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1171) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:233) at android.os.Looper.loop(Looper.java:334) at android.app.ActivityThread.main(ActivityThread.java:8396) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)

I just recorded this error today from google Robo testLab. I was using Pixel 6a, API nível 32 with RN 0.68.1 I can’t share the video but the steps was this:

{
...[More steps]...
  }, {
    "sequence": 301,
    "sourceScreenId": "73",
    "destinationScreenId": "80",
    "startTimeSeconds": 576.609728,
    "endTimeSeconds": 578.248523,
    "executionResult": "SUCCESS",
    "target": {
      "type": "SWIPE",
      "childSequence": "0.0.1.0.1.0.0.0.0.0.0.0.1.0.0.0.0.0.0.0.0.0.0.0.1.0.0.0.0.1.0.0.0.1",
      "targetDetails": {
        "className": "y7.d",
        "androidClassName": "android.widget.HorizontalScrollView"
      }
    }
  }, {
    "sequence": 302,
    "sourceScreenId": "80",
    "destinationScreenId": "80",
    "startTimeSeconds": 578.897558,
    "endTimeSeconds": 579.630209,
    "executionResult": "SUCCESS",
    "target": {
      "type": "SWIPE",
      "childSequence": "0.0.1.0.1.0.0.0.0.0.0.0.1.0.0.0.1.1.0.2",
      "targetDetails": {
        "className": "com.facebook.react.views.text.s",
        "androidClassName": "android.widget.TextView",
        "textLabel": "Início"
      }
    }
  }, {
    "sequence": 303,
    "sourceScreenId": "80",
    "destinationScreenId": "80",
    "startTimeSeconds": 580.006176,
    "endTimeSeconds": 581.236872,
    "executionResult": "TERMINATED",
    "target": {
      "type": "TAP",
      "childSequence": "0.0.1.0.1.0.0.0.0.0.0.0.1.0.0.0.1.1.0",
      "targetDetails": {
        "className": "com.facebook.react.views.view.g",
        "androidClassName": "android.view.ViewGroup"
      }
    }
  }]
}

The step 301 was a single swipe on a HorizontalScroll list (with 12 items) until about 95% of it’s end, Step 302: The script waited about 1s before clicking on the home tab called Inicio Step 303: The home screen was already loaded and the script seems to have tried to click in something but it did crashed so fast (less than a half sec) that it couldn’t event show the TAP in the video it self.

An alternative would be to lock it, and just tell people to submit PRs to try and improve the situation. Would that be better?

As a disciplined, silent watcher of this issue, I support that 🙏

@MuhammadRafeh this issue needs a clean reproduction. Do you have one to share? If not, there’s no progress. If no one else posts one, there’s no progress. No need to ask, you’ll see someone post it here, then you can just see it

Here is what I get on google play console.

com.facebook.react.bridge.JSApplicationIllegalArgumentException: 
  at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes (NativeAnimatedNodesManager.java:340)
  at com.facebook.react.animated.NativeAnimatedModule$15.execute (NativeAnimatedModule.java:681)
  at com.facebook.react.animated.NativeAnimatedModule.executeAllOperations (NativeAnimatedModule.java:258)
  at com.facebook.react.animated.NativeAnimatedModule.access$400 (NativeAnimatedModule.java:85)
  at com.facebook.react.animated.NativeAnimatedModule$3.execute (NativeAnimatedModule.java:287)
  at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute (UIViewOperationQueue.java:579)
  at com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:915)
  at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:1026)
  at com.facebook.react.uimanager.UIViewOperationQueue.access$2600 (UIViewOperationQueue.java:47)
  at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:984)
  at com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:31)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8680)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:567)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)

another thing is that all the reports comes from Samsung Galaxy A13 and i cant find this device on samsung emulator websites

I can confirm this is happen on our app as well, this came from ‘VIVO V2120’ on android 12

Here’s the stack trace,

Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException: connectAnimatedNodes: Animated node with tag (child) [925] does not exist
       at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes(NativeAnimatedNodesManager.java:340)
       at com.facebook.react.animated.NativeAnimatedModule$15.execute(NativeAnimatedModule.java:681)
       at com.facebook.react.animated.NativeAnimatedModule.executeAllOperations(NativeAnimatedModule.java:258)
       at com.facebook.react.animated.NativeAnimatedModule.access$400(NativeAnimatedModule.java:85)
       at com.facebook.react.animated.NativeAnimatedModule$3.execute(NativeAnimatedModule.java:287)
       at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute(UIViewOperationQueue.java:579)
       at com.facebook.react.uimanager.UIViewOperationQueue$1.run(UIViewOperationQueue.java:915)
       at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches(UIViewOperationQueue.java:1026)
       at com.facebook.react.uimanager.UIViewOperationQueue.access$2600(UIViewOperationQueue.java:47)
       at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1086)
       at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
       at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
       at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
       at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1184)
       at android.view.Choreographer.doCallbacks(Choreographer.java:986)
       at android.view.Choreographer.doFrame(Choreographer.java:907)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1171)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:334)
       at android.app.ActivityThread.main(ActivityThread.java:8333)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1065)

@zhuanghongji I see that he put the flag on branch: react-native-version-0.69.1

https://github.com/jefersonvinicius/react-native-crashing-example/blob/react-native-version-0.69.1/android/app/src/main/java/com/crashingtest/MainApplication.java#L57

The main branch have react-native: 0.67.3

If someone want to test, in the repo above, the main branch is the previous version of react native that I found the error at first time. I created a branch react-native-version-0.69.1 where I update the react-native version and add the flag

hey guys ! found any solution for this ? 😕

@ilyagru keep your horses man, better ideas don’t help here. RN team should look into it.

To @LiuIos: As @ergenekonyigit said, you can try that to rebuild, if it’s not suitable for you, you may read official doc Building-from-source. It has been a long time for me to do this, I can’t remember it clearly.

To @ergenekonyigit: Now that this bug can be found in dev mode, I suggest you to use dev mode to reproduce this crash, and get the crash log to see where it crashes (and to check if the modified code works— If not work, maybe the modified code is not merged into your app?).

However, guys, THIS IS NOT A SOLUTION, I suggest you try other methods such as RN-0.69.0-RC as cortinico mentioned, or maybe androidx.work:work-runtime-ktx:2.7.0 as some other guy mentioned.

I understand that it is almost impossible to fix without repro, but that does not mean that the issue does not exist and that it should be closed.

closed means simply that there’s nothing we can do about it. I hope you can understand that seeing constant notification on this issue by comments with really nothing to add is just adding noise on the maintainers. An alternative would be to lock it, and just tell people to submit PRs to try and improve the situation. Would that be better?

People still tagging me like they haven’t read the comments 😂. Please don’t, thank you

Here is what I get on google play console.

com.facebook.react.bridge.JSApplicationIllegalArgumentException: 
  at com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes (NativeAnimatedNodesManager.java:340)
  at com.facebook.react.animated.NativeAnimatedModule$15.execute (NativeAnimatedModule.java:681)
  at com.facebook.react.animated.NativeAnimatedModule.executeAllOperations (NativeAnimatedModule.java:258)
  at com.facebook.react.animated.NativeAnimatedModule.access$400 (NativeAnimatedModule.java:85)
  at com.facebook.react.animated.NativeAnimatedModule$3.execute (NativeAnimatedModule.java:287)
  at com.facebook.react.uimanager.UIViewOperationQueue$UIBlockOperation.execute (UIViewOperationQueue.java:579)
  at com.facebook.react.uimanager.UIViewOperationQueue$1.run (UIViewOperationQueue.java:915)
  at com.facebook.react.uimanager.UIViewOperationQueue.flushPendingBatches (UIViewOperationQueue.java:1026)
  at com.facebook.react.uimanager.UIViewOperationQueue.access$2600 (UIViewOperationQueue.java:47)
  at com.facebook.react.uimanager.UIViewOperationQueue$2.runGuarded (UIViewOperationQueue.java:984)
  at com.facebook.react.bridge.GuardedRunnable.run (GuardedRunnable.java:31)
  at android.os.Handler.handleCallback (Handler.java:938)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at android.app.ActivityThread.main (ActivityThread.java:8680)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:567)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1135)

another thing is that all the reports comes from Samsung Galaxy A13 and i cant find this device on samsung emulator websites

This happen for my app to, the sad thing is that I could only see this issue on Google crashes report.

I cannot reproduce this on debug.

@Sabbaghh if you can reproduce it on empty RN template os please just upload this template project to public repo. Private repo is not needed for bug reproduction)

I’ve used a test app to update and add the flag and I still getting the error on Android 12 and phone Samsung Galaxy S10 SM-G973F. If someone want to test, in the repo above, the main branch is the previous version of react native that I found the error at first time. I created a branch react-native-version-0.69.1 where I update the react-native version and add the flag

@jefersonvinicius have you been able to consistently reproduce this on your test code? I have have reproduced it a few times but its very difficult to do so. (main branch)

I am using Android 12 on Samsung a13 (SM-A135F)

Yes, I’ve been able to reproduce in both main branch and react-native-version-0.69.1 too. Usually the error happens when I’m scrolling or navigating between pages.

I’ve used a test app to update and add the flag and I still getting the error on Android 12 and phone Samsung Galaxy S10 SM-G973F.

If someone want to test, in the repo above, the main branch is the previous version of react native that I found the error at first time. I created a branch react-native-version-0.69.1 where I update the react-native version and add the flag

@jefersonvinicius have you been able to consistently reproduce this on your test code? I have have reproduced it a few times but its very difficult to do so. (main branch)

I am using Android 12 on Samsung a13 (SM-A135F)

I’ve used a test app to update and add the flag and I still getting the error on Android 12 and phone Samsung Galaxy S10 SM-G973F.

If someone want to test, in the repo above, the main branch is the previous version of react native that I found the error at first time. I created a branch react-native-version-0.69.1 where I update the react-native version and add the flag

@zhuanghongji You mentioned one week ago that you will try with 0.69.1 + flag. Were you able to test it? And what results do you had so far? Thanks

It’s testing in a minority of people, can not give a result now.

@hsource I tried to have returns instead of throws at the places where the app is crashing. Probably someone else also did. But this didn’t help, the app seems crashing at another place.

I assume the new React Native 0.69.0 version doesn’t resolve this? Have anyone tried?

Same issue, 100% Android, 100% Samsung, and 100% Galaxy A13 (5 devices)

Hey guys!

I have a React Native (^0.61.5) app published on the store that was crashing both on Android 11 and Android 12.

Managed to fix the problem by adding these lines on build.gradle over android/app inside the dependencies.

I didn’t have any of these lines on the build.gradle! Added all ofthem.

dependencies {
    implementation "androidx.work:work-runtime-ktx:2.7.0"
    implementation("com.squareup.okhttp3:okhttp:4.9.1")
    implementation("com.squareup.okhttp3:okhttp-urlconnection:4.9.1")
}

Hope it helps

ReactFeatureFlags doesn’t have such property, at least on 0.68.2

@yaroslavnikiforov it’ll be available only from React Native 0.69.x: https://github.com/facebook/react-native/issues/33375#issuecomment-1080979397

@coolguy001tv Thanks for the context. You’re correct, that’s a valid bug. After some investigation, we realized that this bug seems to happen ONLY on Android 12 and mostly on Samsung devices.

We still haven’t figured out what is the root cause, but the fix for it should be this: b347c39

Sadly, this commit hasn’t been released yet and won’t be available before React Native 0.69.x. In that version you should be able to execute the extra logic with:

ReactFeatureFlags.enableSynchronizationForAnimated = true

In your Application onCreate section.

@ShikaSD also has more context on this. We’re actively monitoring this bug, and we’ll come back with more context if we do further discoveries.

ReactFeatureFlags doesn’t have such property, at least on 0.68.2

@coolguy001tv thanks,I did not rebuild the project, I modified the react-native-0.64.2-sources.jar files,How to rebuild react-native?

You can try this way in android/app/build.gradle

add this

dependencies { … implementation “androidx.work:work-runtime-ktx:2.7.0” }

No effect,RN 0.64.2

@harsh-sangwan-mmt I am on rn 0.67.3 and was able to apply a temporary workaround/hack on my project based on @coolguy001tv 's solution here. I’m not ready to upgrade to nighties. This involves forking rn, checking out the correct version, commenting out where the native error is triggered, building react-native from source, and using that forked version. So far, I haven’t seen the issue for a few weeks with a 10k userbase. Probably not the way to do it properly, but at least we aren’t getting crashes anymore.

@harsh-sangwan-mmt For there’re too many files modified, so I don’t put it here. But I have to say, after the modification, I find nearly no crash any more in production (I know it will crash sometimes with very heavy operations, but maybe in production people just use it in not such a rude way). And however, it’s not the final way, I am also waiting for the official solution.

Maybe there are unknown issue or not of modifying code privately, so waiting for the official solution is way now.

@harsh-sangwan-mmt

I am on rn 0.67.3 and was able to apply a temporary workaround/hack on my project based on @coolguy001tv 's solution here. I’m not ready to upgrade to nighties.

This involves forking rn, checking out the correct version, commenting out where the native error is triggered, building react-native from source, and using that forked version. So far, I haven’t seen the issue for a few weeks with a 10k userbase.

Probably not the way to do it properly, but at least we aren’t getting crashes anymore.

@cortinico Is there any way i can help to test b347c39 if it really fix the randomly crash ?

You could bump RN version to a nightly: 0.0.0-20220322-2008-8a5460ce8

@cortinico sorry to disturb, but can you help us to solve this bug in android 12? It bothers us a lot in such a long time and there’s still no one can offer deeper help.

Sorry we can’t help you here. The versions of RN you’re using is too old (we’re at 0.67 and about to release 0.68). If this issue is still happening on 0.67/0.68 AND we have a valid reproducer -> Then we can look into it.

I’m having the same problem for a few weeks now. I also confirm that it happens just on devices running Android 12… It just crashes randomly. I tried to remove all Animated uses from the project, even removed all dependencies that used it, but the problem persisted, which makes me think that it is indeed a ReactNative issue.

@guptayush thanks for the reply. But it doesn’t help me a lot. I tried to comment the setImmediate rows (there’s only one component using it in my project) , it still crashed. Actually, my project has hundreds of pages, I don’t know if it’s some other animated things affect.

I’am getting this error too!

I created a repo with a simple app as example: https://github.com/jefersonvinicius/react-native-crashing-example

Some extra information:

  • At least with me, the error just happens in release apk. The app works perfectly in debug mode.
  • The error is happening in an Android 12 device, a Galaxy S10 SM-G973F. I tried replicate the error in Android 9 but no error is threw.
  • I don’t know if is related, but I realize the crash happens often when I’am scrolling.

Nearly the same, but I got this error even in debug mode randomly. I am facing this problem in Mi12(Xiaomi 2201123C) with Android 12. It seems ok in other devices using android 10/9/8 or ios.