react-native: Random JSApplicationIllegalArgumentException crashes on Android
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
React Native Environment Info: System: OS: macOS 10.14 CPU: x64 Intel® Core™ i7-4770HQ CPU @ 2.20GHz Memory: 40.02 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.6.0 - /usr/local/bin/node Yarn: 1.6.0 - ~/.yarn/bin/yarn npm: 5.3.0 - /usr/local/bin/npm Watchman: 4.7.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0 Android SDK: Build Tools: 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3 API Levels: 21, 23, 25, 26, 27, 28 IDEs: Android Studio: 2.2 AI-145.3537739 Xcode: 10.0/10A255 - /usr/bin/xcodebuild npmPackages: react: 16.5.0 => 16.5.0 react-native: 0.57.2 => 0.57.2 npmGlobalPackages: create-react-native-app: 1.0.0 react-native-cli: 1.3.0 react-native-git-upgrade: 0.2.7
Android build versions: buildToolsVersion = “27.0.3” minSdkVersion = 21 compileSdkVersion = 27 targetSdkVersion = 27 supportLibVersion = “27.1.1”
Description
Hi there, since I upgraded to react native 0.57 I receive some crashes on Android. It’s not reproducable, but If I e.g reload a list over and over again the app crashes at some point (sometimes it takes 100 tries, sometimes only 2 or 3). The exception is always a JSApplicationIllegalArgumentException. But with different properties (height, width, paddingHorizontal, …). I have no glue where it is coming from, because the crashes also occure on different places in the app.
If you need more information I’m glad to help.
Thanks David
The stacktrace from sentry looks like this:
java.lang.ClassCastException: Value for fill cannot be cast from ReadableNativeArray to Double
at com.facebook.react.bridge.ReadableNativeMap.checkInstance(ReadableNativeMap.java:148)
at com.facebook.react.bridge.ReadableNativeMap.getValue(ReadableNativeMap.java:127)
at com.facebook.react.bridge.ReadableNativeMap.getDouble(ReadableNativeMap.java:168)
at com.facebook.react.bridge.DynamicFromMap.asDouble(DynamicFromMap.java:64)
at com.facebook.react.uimanager.LayoutShadowNode$MutableYogaValue.setFromDynamic(LayoutShadowNode.java:67)
at com.facebook.react.uimanager.LayoutShadowNode.setHeight(LayoutShadowNode.java:157)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateShadowNodeProp(ViewManagersPropertyCache.java:105)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackShadowNodeSetter.setProperty(ViewManagerPropertyUpdater.java:157)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:61)
at com.facebook.react.uimanager.ReactShadowNodeImpl.updateProperties(ReactShadowNodeImpl.java:458)
at com.facebook.react.uimanager.UIImplementation.createView(UIImplementation.java:295)
at com.facebook.react.uimanager.UIManagerModule.createView(UIManagerModule.java:377)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:764)
java.lang.reflect.InvocationTargetException: null
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateShadowNodeProp(ViewManagersPropertyCache.java:105)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackShadowNodeSetter.setProperty(ViewManagerPropertyUpdater.java:157)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:61)
at com.facebook.react.uimanager.ReactShadowNodeImpl.updateProperties(ReactShadowNodeImpl.java:458)
at com.facebook.react.uimanager.UIImplementation.createView(UIImplementation.java:295)
at com.facebook.react.uimanager.UIManagerModule.createView(UIManagerModule.java:377)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:764)
com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'height' in shadow node of type: RCTView
at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateShadowNodeProp(ViewManagersPropertyCache.java:116)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackShadowNodeSetter.setProperty(ViewManagerPropertyUpdater.java:157)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:61)
at com.facebook.react.uimanager.ReactShadowNodeImpl.updateProperties(ReactShadowNodeImpl.java:458)
at com.facebook.react.uimanager.UIImplementation.createView(UIImplementation.java:295)
at com.facebook.react.uimanager.UIManagerModule.createView(UIManagerModule.java:377)
at java.lang.reflect.Method.invoke(Method.java)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
at com.facebook.react.bridge.queue.NativeRunnable.run(NativeRunnable.java)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
at android.os.Looper.loop(Looper.java:164)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
at java.lang.Thread.run(Thread.java:764)
Reproducible Demo
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 26
- Comments: 37 (3 by maintainers)
I can confirm. Crashlytics gives us more and more this kind of report since we have upgraded react-native to 0.57 Most common crashes are:
Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException Error while updating property 'marginBottom' in shadow node of type: RCTText
Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException Error while updating property 'bottom' in shadow node of type: RCTView
Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException Error while updating property 'paddingHorizontal' in shadow node of type: RCTView
Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException Error while updating property 'fill' of a view managed by: RNSVGPath
Is there any workaround /solution /planned bugfix for that?
We are seeing a lot of these crashes in Android and are on RN 59.10. Are there any plans to fix this soon?
did #17842 already in RN 0.57.3? Our project met serveral reports since upgrade RN 0.57.x version.
one more note: This type of crash has outstanding rate in Samsung devices with android 7.0+ than others.
@sinodko In last version of our application i upgraded RN version to 0.59.10 and still this error occurs
If you are integrating the React Native app into an existing native app, make sure that you are using a single instance of
ReactInstanceManager
, not multiple ones (as stated in the doc). After using a single instance for all the screens these kinds of crashes are gone.@bigggge Hello there! I suggest you to upgrade react-native version to at least 0.59.10! This version contains newer version of JSC which is preventing from exactly these errors in your app.
@hramos FYI there’s no PR for the comment that’s linked https://github.com/facebook/react-native/issues/17873#issuecomment-427272741 so “Fixed” label will be misleading. I believe people who say it’s fixed are building RN from source and applying this fix on their own.
RN 0.57.4 available.
Any idea if this will be back-ported to older RN releases like 0.55?
@prof18 Thank you for this!
@Winglonelion it’s not released yet. It’s planned for version 0.57.4. You can track it here https://github.com/react-native-community/react-native-releases/issues/48#issuecomment-431416538.