expo: Crash on android standalone app using Reanimated 2 with SDK 40
🐛 Bug Report
Summary of Issue
Standalone build crashes when opening it on my android physical device (galaxy S8 used). Related to https://github.com/expo/expo/issues/10564 and https://github.com/expo/expo/issues/11529
Environment - output of expo diagnostics & the platform(s) you’re targeting
Expo CLI 4.0.17 environment info: System: OS: Linux 5.4 Ubuntu 18.04.4 LTS (Bionic Beaver) Shell: 5.4.2 - /usr/bin/zsh Binaries: Node: 12.15.0 - /usr/bin/node Yarn: 1.22.5 - /usr/bin/yarn npm: 6.13.4 - /usr/bin/npm SDKs: Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.2 System Images: android-28 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom npmPackages: expo: ~40.0.0 => 40.0.0 react: 16.13.1 => 16.13.1 react-dom: 16.13.1 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2 react-native-web: ~0.13.12 => 0.13.18 npmGlobalPackages: expo-cli: 4.0.17 Expo Workflow: managed
I’m targeting both IOS and android but I can’t test it on IOS.
Reproducible Demo
https://github.com/adblanc/reanimated2-crash-repo
Steps to Reproduce
- expo init (blank typescript)
- Follow SDK 40 doc
- yarn add react-native-reanimated@2.0.0-rc.0
- add reanimated plugin to babel.config.js
- Add some reanimated code to App.tsx
Expected Behavior vs Actual Behavior
I expect my app to start and function correctly, as it does when using expo client. Instead, by debugging it using adb logcat, I get the following error on start :
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found
01-19 10:20:18.850 9249 9322 E ReactNativeJNI: logMarker RUN_JS_BUNDLE_END 01-19 10:20:18.853 9249 9322 I ReactNativeJS: Running "main" with {"initialProps":{"exp":{"initialUri":"https://expo.io:443/@adrienblc/r2-test","lastErrors":[{"errorMessage":"Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary., stack:\nexports@21:286\ngetEnforcing@27:169\n<unknown>@794:197\nv@2:1473\n<unknown>@793:156\nv@2:1473\n<unknown>@788:6077\nv@2:1473\n<unkno","isFatal":true,"exceptionId":-922570819}],"manifest":{"releaseChannel":"default","isVerified":true,"dependencies":["expo","expo-status-bar","react","react-dom","react-native","react-native-reanimated","react-native-web"],"web":{"favicon":"./assets/favicon.png"},"version":"1.0.0","slug":"r2-test","iconUrl":"https://d1wp6m56sqw74a.cloudfront.net/~assets/4e3f888fc8475f69fd5fa32f1ad5216a","name":"r2-test","locales":{},"releaseId":"cfc61a21-600b-4cd0-b097-df05c05f8eb0","platforms":["ios","android","web"],"icon":"./assets/icon.png","hostUri":"exp.host/@adrienblc/r2-test","ios":{"supportsTablet":true},"android":{"adaptiveIcon":{"foregroundImageUrl":"https://d1wp6m56sqw74a.cloudfront.net/~assets/97dae5a0e62ad8551d8a31897b425e63","backgroundColor":"#FFFFFF","foregroundImage":"./assets/adaptive-icon.png"},"package":"com.adrienblc.r2test"},"id":"@adrienblc/r2-test","bundleUrl":"https://d1wp6m56sqw74a.cloudfront.net/%40adrienblc%2Fr2-test%2F1.0.0%2F4c4740d7f67576cf3440c8696c5ebdf4-40.0.0-android.js","splash":{"resizeMode":"contain","backgroundColor":"#ffffff","image":"./assets/splash.png","imageUrl":"https://d1wp6m56sqw74a.cloudfront.net/~assets/201a91bd1740bb1d6a1dbad049310724"},"updates":{"fallbackToCacheTimeout":0},"bundledAssets":["asset_3a2ba31570920eeb9b1d217cabe58315.ttf","asset_8b12b3e16d591abc926165fa8f760e3b.json","asset_744ce60078c17d86006dd0edabcd59a7.ttf","asset_461d9bba8b6a3c91675039df12cfe6ca.json","asset_140c53a7643ea949007aa9a282153849.ttf","asset_94c4ffdcbffeb0570c635d7f8edd8a25.json","asset_e766963327e0a89f9ec2ba88646b6177.ttf","asset_83d0d0700e24da7297be10ae931dd38f.json","asset_b49ae8ab2dbccb02c4d11caaacf09eab.ttf","asset_39843e5d52a6c5c42d5abdb0b34bcaa6.json","asset_b06871f281fee6b241d60582ae9369b9.ttf","asset_f1f91feb805137c9283fb766620ec5eb.json","asset_276ee4e65ded9a91cfe0be813e95e42d.json","asset_8d09f2281ac9c99f438fb1c0b5c66d20.json","asset_db78b9359171f24936b16d84f63af378.ttf","asset_1ab236ed440ee51810c56bd16628aef0.ttf","asset_13685372945d816a2b474fc082fd9aaa.ttf","asset_e20945d7c929279ef7a6f1db184a4470.ttf","asset_60668d999bbaf663420340f7bdd580d7.json","asset_b3263095df30cb7db78c613e73f9499a.ttf","asset_bb0e1479c256e29e7ee92433a5e4b43e.json","asset_6a2ddad1092a0a1c326b6d0e738e682b.ttf","asset_f337aab857fd04843f0a882ec5726fb3.json","asset_8ef52a15e44481b41e7db3c7eaf9bb83.ttf","asset_fdbedb7e67aa7c0ecad83d9c2fa4dfba.json","asset_8e7f807ef943bff1f6d3c2c6e0f3769e.ttf","asset_fdc01171a7a7ea76b187afcd162dee7d.json","asset_d2285965fe34b05465047401b8595dd0.ttf","asset_647543ebfccf6e5495434383598453d1.json","asset_5cdf883b18a5651a29a4d1ef276d2457.ttf","asset_74d124a3caeac2bea111f3ca2f2dd34a.json"],"commitTime":"2021-01-19T09:02:41.149Z","orientation":"portrait","publishedTime":"2021-01-19T09:02:41.097Z","revisionId":"1.0.0-r.8_v2LgtAv","sdkVersion":"40.0.0"},"shell":true}},"rootTag":1} 01-19 10:20:18.854 9249 9322 W ReactNativeJS: Unable to start your application. Please refer to https://expo.fyi/no-registered-application for more information. 01-19 10:20:18.864 9249 9322 E ReactNativeJS: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary. 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: CatalystInstanceImpl caught native exception 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: com.facebook.react.common.JavascriptException: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary., stack: 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: exports@21:286 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: getEnforcing@27:169 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: <unknown>@794:197 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: <unknown>@793:156 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: <unknown>@788:6077 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: <unknown>@748:1674 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: <unknown>@747:945 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: <unknown>@6:60 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: d@2:875 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: global code@827:3 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:12) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at java.lang.reflect.Method.invoke(Native Method) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:18) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:2) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at android.os.Handler.handleCallback(Handler.java:873) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at android.os.Handler.dispatchMessage(Handler.java:99) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at android.os.Looper.loop(Looper.java:214) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8) 01-19 10:20:18.872 9249 9323 E unknown:ReactNative: at java.lang.Thread.run(Thread.java:764) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: Caught exception 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: com.facebook.react.common.JavascriptException: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary., stack: 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: exports@21:286 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: getEnforcing@27:169 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: <unknown>@794:197 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: <unknown>@793:156 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: <unknown>@788:6077 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: <unknown>@748:1674 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: <unknown>@747:945 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: <unknown>@6:60 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: v@2:1473 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: d@2:875 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: global code@827:3 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:12) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at java.lang.reflect.Method.invoke(Native Method) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:18) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:2) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at android.os.Handler.handleCallback(Handler.java:873) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at android.os.Handler.dispatchMessage(Handler.java:99) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:1) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at android.os.Looper.loop(Looper.java:214) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:8) 01-19 10:20:18.872 9249 9323 E unknown:DisabledDevSupportManager: at java.lang.Thread.run(Thread.java:764) 01-19 10:20:18.873 9249 9249 D AndroidRuntime: Shutting down VM 01-19 10:20:18.873 9249 9249 E AndroidRuntime: FATAL EXCEPTION: main 01-19 10:20:18.873 9249 9249 E AndroidRuntime: Process: com.adrienblc.r2test, PID: 9249 01-19 10:20:18.873 9249 9249 E AndroidRuntime: java.lang.RuntimeException: Expo encountered a fatal error: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary., stack: 01-19 10:20:18.873 9249 9249 E AndroidRuntime: exports@21:286 01-19 10:20:18.873 9249 9249 E AndroidRuntime: getEnforcing@27:169 01-19 10:20:18.873 9249 9249 E AndroidRuntime: <unknown>@794:197 01-19 10:20:18.873 9249 9249 E AndroidRuntime: v@2:1473 01-19 10:20:18.873 9249 9249 E AndroidRuntime: <unknown>@793:156 01-19 10:20:18.873 9249 9249 E AndroidRuntime: v@2:1473 01-19 10:20:18.873 9249 9249 E AndroidRuntime: <unknown>@788:6077 01-19 10:20:18.873 9249 9249 E AndroidRuntime: v@2:1473 01-19 10:20:18.873 9249 9249 E AndroidRuntime: <unkno 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at host.exp.exponent.experience.q.E(BaseExperienceActivity.java:7) 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at host.exp.exponent.experience.a.run(Unknown Source:2) 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:873) 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:99) 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at android.os.Looper.loop(Looper.java:214) 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:7050) 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494) 01-19 10:20:18.873 9249 9249 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 8
- Comments: 42 (15 by maintainers)
Commits related to this issue
- Add example apk for https://github.com/expo/expo/issues/11672 — committed to brentvatne/files by brentvatne 3 years ago
Awesome @brentvatne I tested your APK on various android devices and I haven’t seen any crash either, thanks for everything including @lukmccall 🙌
will leave issue open until fix is deployed
i’ll let you know when it’s live
I had this problem in sdk39 and 40. as per advice in my last issue #11266 I have waited till official support of reanimatedv2 and it is now available with sdk41. But the issue is same.
App works fine in expo go app even in production mode with minify which should be equivalent to standalone apk. Only standalone apk is failing.
I have created a new project after the news of official support of reanimatedv2 and when I ran first build it still had the same problem. Project link: https://github.com/phoenixcreation/relaxer
If you think I am doing something wrong please clone the repo and create a standalone build of it. Then test it and let me know if it works or not.
If anyone finds the solution of this please let us know. Thanks in advance.
yup, it’s something weird that happened only twice on android devices, the striking thing is that just yesterday I did an ota update (that’s why I mentioned it).
I will be verifying, if it happens again I will create an incident in the reanimated repo, but it is good that you are also aware of this just in case
Sometimes and very sporadically, some devices with android throw me this fault and report it by sentry. @brentvatne can it be that after an OTA update, reanimated does not initialize correctly?
I am using SDK41 and reanimated “~ 2.1.0” on managed workflow
Here is the code on the line where the error was thrown:
https://github.com/outaTiME/ambito-dolar/blob/master/packages/client/components/VictoryRateChartView.js#L336
@adblanc - great! this is in production now. give it a try with
expo buildwe will be deploying the fix from #12650 this afternoon
@brentvatne no problem, it depends but right now it crashed 7 times out of 10 attempts
My solution was to create a new App without Expo 🙄
Let me know if I can help you somehow solving this issue though. Would be great to be able to use Expo in the near future to build production-ready Apps, as I love the seamless workflow your team created here 😊
Unfortunately experiencing the same issue as @brandtnewww with SDK BETA 41, it appears to be a different error than the one we’re having with SDK 40 so maybe I should create another issue and try to create a reproducible example
The issue still exists. I just created an .aab file and set up an internal test on Google Play Store.
Expo SDK 41.0.0 Android 10 Pixel 3a
Error If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/installation
Crashes at
const scale = useSharedValue(1)in production. Not in Dev.“expo”: “^41.0.0-beta.3”, “react-native-reanimated”: “~2.1.0”,
babel.config.js: module.exports = function (api) { api.cache(true) return { presets: [‘babel-preset-expo’], plugins: [‘react-native-reanimated/plugin’] } }
Couldn’t reproduce it either with your apk, excited to upgrade to SDK 41 😄
@brentvatne awesome. When you have a fix, I’ll be happy to try it out again to verify. Good luck 🤞
you’re right, closing and reopening it reproduces this issue, thank you @msevestre!
@brentvatne I just tried the install on my phone (Pixel 4). The app opens the first time. I toggled the button a few time. All good. Then I closed the app, started the app again a couple times and the crashed happened again. The app opens and closes right away. Looks exactly like the issue I had a few weeks ago.
Anything else I can do to help?