Closed LiuIos closed 2 years ago
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:
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.
Is there a solution?
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.
https://github.com/facebook/react-native/issues/33400 seems the same problem...
same here
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.
@coolguy001tv can you try setImmediate(()=> LayoutAnimation.configureNext(androidAnimation))
@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.
I tried your example in 0.67.1 with Mi12(Xiaomi 2201123C, android 12), which still crashed in debug mode and release apk. But I can only reproduce the crash in your Listing Page in the example, I can't reproduce in Animations Page.
Can somebody help? I get nearly mad...
Can somebody help? I get nearly mad...
Yesterday i got a fool-way but not try yet to avoid the crash for a short time:
com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes
and add try...catch...
to wrap all method body.aar
file to replace ./node_modules/react-native/android/.../...aar
fileLooked 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.
How can I disable all the animation? I have hundreds of pages and some other dependencies...
Can somebody help? I get nearly mad...
Yesterday i got a fool-way but not try yet to avoid the crash for a short time:
- clone the match-react-native-version code
- goto
com.facebook.react.animated.NativeAnimatedNodesManager.connectAnimatedNodes
and addtry...catch...
to wrap all method body- rebuild a
.aar
file to replace./node_modules/react-native/android/.../...aar
file- maybe in 3th step, should replace all file in the dir
I am trying to do this too...
But it's so hard to rebuild react-native in windows, I failed again and again with error like missing xxx.o
.
But my colleague who is using mac seems to succeed. I'll try this method. When I have any new info, I shall talk here.
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
any updates on this issue? it happens only on android 12 devices. This crash also happens java.lang.IllegalArgumentException Invalid parent node provided
We are also meeting those exceptions like java.lang.IllegalArgumentException
,Invalid parent node provided
etc.
Actually, we replace throw new JSApplicationIllegalArgumentException(...)
to return
in many files to try to avoid such exception. Because those exception throws after condition like if (parentNode == null)
or if (childNode == null)
, I think maybe those node are released somewhere, so I'd like just to return
instead of throw exception
.(Of course it's not right to do so, for doing this may lead some memory leaks, but for now I have no other better idea).
After doing this, we find the crash happened less than before.(The log shows it indeed gets into the code before the return
statement we just replaced, and without the exception, app can continue). But sometimes we find the app may freeze. When freezed, sometimes it may recover by locking the screen and then unlocking the screen (sometimes this operation won't help).
We know the right thing should be look deeper in why parentNode/childNode is null, but we are not android developer, so we have to try to bypass those exceptions.
Still waiting for help...
Facing the same issue. it happens only on android 12 devices.
Sentry log - https://sentry.io/share/issue/412e43bba0594b70a3e4327ecbb4199d/
Any solution or workaround?
@LiuIos Maybe the title can be modified to be android 12 to be more specific. It seems that it happens only on android 12 devices according to our discussion.
@coolguy001tv 👌
@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.
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.
Has anyone tried react-native@0.63.4? I found that some people said it would be OK to reduce from 64 to 63.
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.
I did not get this error with mi 10 pro device!
I tried this sample project,but did not crashed in any page.Maybe my testing device is ok with this issue.But I fond that some people said it would be OK to reduce react-native from 64 to 63,can you try it and offer the result?
what about 0.66?
Has anyone tried react-native@0.63.4? I found that some people said it would be OK to reduce from 64 to 63.
Can u post more info(like url) on this discussion? And what's your android version in mi 10 pro device?
Has anyone tried react-native@0.63.4? I found that some people said it would be OK to reduce from 64 to 63.
Can u post more info(like url) on this discussion? And what's your android version in mi 10 pro device?
my device's android version is 12.It is upgrated yesterday.
@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 was having this problem on 0.66, updated to 0.67.3 and still have the problem. I'll try to create a reproducible code later.
@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.
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.
I did not get this error with mi 10 pro device!
I tried this sample project,but did not crashed in any page.Maybe my testing device is ok with this issue.But I fond that some people said it would be OK to reduce react-native from 64 to 63,can you try it and offer the result?
@yanxlg Because the crash is randomly happening, u may need to try to scroll fast, click fast as possible as u can, this helps you meet the crash sooner( acutally we found this crash in a very normal operation, but this kind of heavy operation can speed up the crash time).
And btw, what's the phone model and system u are using?
@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.
@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.
@cortinico Is there any way i can help to test b347c39 if it really fix the randomly crash ?
I tried to build main-branch source code, but something blocked me.
@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 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
Is there anyone who tried this version? I am so sorry that these days I have been too busy to test it.
"react": "^17.0.2",
"react-native": "^0.67.2",
my app crash immediately on android 12
in my case i found the problem come from react native maps
"react-native-maps": "^0.30.1",
to fix this problem
diff --git a/node_modules/react-native-maps/lib/android/build.gradle b/node_modules/react-native-maps/lib/android/build.gradle
index 8d6cef1..a71642f 100644
--- a/node_modules/react-native-maps/lib/android/build.gradle
+++ b/node_modules/react-native-maps/lib/android/build.gradle
@@ -17,7 +17,7 @@ android {
}
dependencies {
- def work_version = "2.5.0"
+ def work_version = safeExtGet('targetSdkVersion', 27) < 31 ? "2.5.0" : "2.7.1"
def supportLibVersion = safeExtGet('supportLibVersion', '28.0.0')
def supportLibMajorVersion = supportLibVersion.split('\\.')[0] as int
def appCompatLibName = (supportLibMajorVersion < 20) ? "androidx.appcompat:appcompat" : "com.android.support:appcompat-v7"
@feras-merwas It seems your problem is not as same as ours. I (most likely we) don't use react-native-maps but still suffer the crash. But your comment may help someone else~
I found that Swipeable with React-Native-Gesture-Handler in list is very easy to crashe, in Android 12
@coolguy001tv were you able to find any temporary solution for the problem?
@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.
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 alluseNativeDriver
tofalse
, but the crash still exits.
Did it reduce the number of crashes, If not finishing them completely, As I can see in other answers, some folks are claiming, It worked for them https://stackoverflow.com/a/63551341
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 alluseNativeDriver
tofalse
, but the crash still exits.Did it reduce the number of crashes, If not finishing them completely, As I can see in other answers, some folks are claiming, It worked for them https://stackoverflow.com/a/63551341
Not sure if the crash reduced or not, i just turn off useNativeDriver
in dev environment and find out the crash still exits.
@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.
@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.
Modified react-native-0.64.2-sources.jar files Still crashes
I amnotation all the code
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
You can try this way in android/app/build.gradle
add this
dependencies { .... implementation "androidx.work:work-runtime-ktx:2.7.0" }
You can try this way in android/app/build.gradle
add this
dependencies { .... implementation "androidx.work:work-runtime-ktx:2.7.0" }
have you tried? it worked?
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(R) Core(TM) 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