expo / expo

An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
https://docs.expo.dev
MIT License
32.92k stars 5.24k forks source link

Crash on android standalone app using Reanimated 2 with SDK 40 #11672

Closed adblanc closed 3 years ago

adblanc commented 3 years ago

🐛 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

  1. expo init (blank typescript)
  2. Follow SDK 40 doc
    • yarn add react-native-reanimated@2.0.0-rc.0
    • add reanimated plugin to babel.config.js
  3. 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@794:197\nv@2:1473\n@793:156\nv@2:1473\n@788:6077\nv@2:1473\n@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: @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: @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: @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: @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: @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: @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: @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: @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: @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: @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: @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: @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: @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: @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:
exseniorastronaut commented 3 years ago

@adblanc I am glad you were able to reproduce it. The other day I tried myself using the template and I wasn't able to reproduce it

outaTiME commented 3 years ago

I here with the same problem, randomly some of my android users experience unexpected closings at the time of opening the application (cold start),

a while ago I created an issue in the reanimated repository:

https://github.com/software-mansion/react-native-reanimated/issues/1454

as well as some comments on the following expo issues:

https://github.com/expo/expo/issues/10564 https://github.com/expo/expo/issues/11266 https://github.com/expo/expo/issues/11529

Today one of the users of my application shared the error log and video of the crash:

105799163-9bd0e080-5f72-11eb-8a1d-d27f8302eb5c

https://user-images.githubusercontent.com/140472/105931514-1c9ee380-602a-11eb-931c-bc68d57da52f.MOV

The phone is a moto g (8) power lite, but it happens with some other devices too, here I attach a screenshot from the google play console:

Screen Shot 2021-01-26 at 01 10 17

I was looking at some issues of reanimated there are several incidents that point to the same thing but I do not know if they are related in any way or could it be something of the configuration of the "android" workers of Expo?

Here I also attach the files of the configuration of my application,

package.json:

{
  "name": "ambito-dolar",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "release": "release-it --no-npm.publish"
  },
  "dependencies": {
    "@expo/react-native-action-sheet": "^3.4.1",
    "@rainbow-me/animated-charts": "^1.0.0-alpha.3",
    "@react-native-community/hooks": "^2.5.1",
    "@react-native-community/masked-view": "0.1.10",
    "@react-navigation/bottom-tabs": "^5.4.5",
    "@react-navigation/native": "^5.2.0",
    "@react-navigation/stack": "^5.2.9",
    "@use-expo/font": "^2.0.0",
    "@zeit/fetch-retry": "^5.0.0",
    "d3-array": "^2.4.0",
    "deep-diff": "^1.0.2",
    "expo": "^40.0.0",
    "expo-analytics-amplitude": "~9.0.0",
    "expo-app-loading": "^1.0.1",
    "expo-constants": "~9.3.3",
    "expo-device": "~2.4.0",
    "expo-file-system": "~9.3.0",
    "expo-image-manipulator": "~8.4.0",
    "expo-linking": "~2.0.0",
    "expo-localization": "~9.1.0",
    "expo-mail-composer": "~9.0.0",
    "expo-notifications": "~0.8.2",
    "expo-sharing": "~8.5.0",
    "expo-status-bar": "~1.0.3",
    "expo-store-review": "~2.3.0",
    "firebase": "7.9.0",
    "i18n-js": "^3.5.1",
    "immutability-helper": "^3.0.0",
    "lodash": "^4.17.15",
    "moment": "^2.29.0",
    "numeral": "^2.0.6",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-appearance": "~0.3.3",
    "react-native-collapsible": "^1.5.1",
    "react-native-gesture-handler": "~1.8.0",
    "react-native-iphone-x-helper": "^1.2.1",
    "react-native-reanimated": "2.0.0-rc.0",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "~2.15.0",
    "react-native-segmented-control-tab": "^3.4.1",
    "react-native-svg": "12.1.0",
    "react-native-typography": "^1.4.0",
    "react-native-view-shot": "3.1.2",
    "react-native-web": "~0.13.12",
    "react-navigation-header-buttons": "^6.0.0",
    "react-redux": "^7.1.1",
    "redux": "^4.0.1",
    "redux-persist": "^6.0.0",
    "redux-persist-expo-filesystem": "^2.0.0",
    "redux-persist-transform-filter": "^0.0.20",
    "redux-thunk": "^2.3.0",
    "reselect": "^4.0.0",
    "semver": "^7.1.1",
    "sentry-expo": "~3.0.2",
    "swr": "^0.4.0",
    "victory": "^35.0.8",
    "victory-native": "^35.0.1"
  },
  "devDependencies": {
    "@expo/webpack-config": "~0.12.45",
    "@typescript-eslint/eslint-plugin": "^4.12.0",
    "@typescript-eslint/parser": "^4.12.0",
    "babel-plugin-inline-dotenv": "^1.6.0",
    "babel-plugin-module-resolver": "^4.0.0",
    "babel-preset-expo": "8.3.0",
    "dotenv": "^8.2.0",
    "eslint": "^7.17.0",
    "eslint-config-universe": "^7.0.0",
    "prettier": "^2.2.1",
    "redux-devtools-extension": "^2.13.8",
    "release-it": "^14.0.3",
    "typescript": "^4.1.3"
  },
  "resolutions": {
    "react-native-gesture-handler": "~1.8.0",
    "react-native-reanimated": "2.0.0-rc.0"
  },
  "version": "3.1.4"
}

app.config.js:

import 'dotenv/config';

const version = '3.1.4';
const buildNumber = 49;

export default {
  name: 'Ámbito Dólar',
  slug: 'ambito-dolar',
  privacy: 'hidden',
  platforms: ['android', 'ios', 'web'],
  version,
  orientation: 'portrait',
  icon: './assets/icon.png',
  splash: {
    image: './assets/splash-dark-content.png',
    resizeMode: 'contain',
    backgroundColor: '#FFFFFF',
  },
  userInterfaceStyle: 'automatic',
  ios: {
    bundleIdentifier: 'im.outa.AmbitoDolar',
    buildNumber: buildNumber.toString(),
    infoPlist: {
      CFBundleDevelopmentRegion: 'es',
      UISupportedInterfaceOrientations: ['UIInterfaceOrientationPortrait'],
      'UISupportedInterfaceOrientations~ipad': [
        'UIInterfaceOrientationLandscapeLeft',
        'UIInterfaceOrientationLandscapeRight',
      ],
      UIRequiresFullScreen: true,
      LSApplicationQueriesSchemes: ['twitter', 'tg', 'instagram', 'fb'],
    },
    supportsTablet: true,
    config: {
      usesNonExemptEncryption: false,
    },
  },
  android: {
    package: 'im.outa.AmbitoDolar',
    versionCode: buildNumber,
    googleServicesFile: './google-services.json',
    icon: './assets/icon.android.png',
    adaptiveIcon: {
      foregroundImage: './assets/icon.android.adaptive.foreground.png',
      backgroundImage: './assets/icon.android.adaptive.background.png',
    },
    permissions: [],
    allowBackup: false,
    softwareKeyboardLayoutMode: 'pan',
    useNextNotificationsApi: true,
  },
  notification: {
    icon: './assets/icon.notification.png',
    color: '#2ECC71',
  },
  hooks: {
    postPublish: [
      {
        file: 'sentry-expo/upload-sourcemaps',
        config: JSON.parse(process.env.SENTRY_HOOK_CONFIG_JSON),
      },
    ],
  },
  updates: {
    fallbackToCacheTimeout: 0,
  },
  assetBundlePatterns: ['**/*'],
};

I hope all this is useful 🙏

outaTiME commented 3 years ago

btw, it seems that if the affected Android users clear the cache and delete the application data the problem would be solved, which again makes me think that it may be something from Expo 🤔

msevestre commented 3 years ago

Hi everyone,

I would like to report the same issue for a managed app using EXPO 40 and Reanimated2.

Deleting the cache and application data DOES NOT solve the problem. The app crashes randomly on start and only on some devices. When it crashes, it crashes on start. I used adb logcat to see what was going on and the same error as mentioned above is reported

02-03 16:11:16.806 27507 27588 W ReactNativeJS: Unable to start your application. Please refer to https://expo.fyi/no-registered-application for more information.

02-03 16:11:16.812 27507 27588 E ReactNativeJS: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary.

02-03 16:11:16.821 27507 27589 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:
omprakashpmfby commented 3 years ago

I am also getting this error

[Wed Feb 10 2021 09:15:51.966] INFO Initializing react-native-branch v. 5.0.1 [Wed Feb 10 2021 09:15:51.967] ERROR Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes [Wed Feb 10 2021 09:15:51.969] ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication), js engine: hermes

System: OS: macOS 10.15.4 CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz Memory: 18.94 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 9.11.2 - ~/.nvm/versions/node/v9.11.2/bin/node Yarn: 1.22.0 - /usr/local/bin/yarn npm: 6.14.6 - ~/.nvm/versions/node/v9.11.2/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.10.1 - /Users/omprakash/.rvm/gems/ruby-2.5.1/bin/pod SDKs: iOS SDK: Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2 Android SDK: API Levels: 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.0, 25.0.2, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.3, 29.0.0, 29.0.2, 29.0.3 System Images: android-23 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 4.0 AI-193.6911.18.40.6514223 Xcode: 12.3/12C33 - /usr/bin/xcodebuild Languages: Java: 1.8.0_242 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: ^4.1.0 => 4.14.0 react: 16.13.1 => 16.13.1 react-native: 0.63.4 => 0.63.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

markneh commented 3 years ago

It might be related to Hermes. I just ejected and got same error but was able to fix it by following instruction on the reanimated documentation site. First step of that instruction is to enable Hermes. As far as I know managed workflow doesn't support Hermes at the moment.

msevestre commented 3 years ago

Hey @EvanBacon @brentvatne

Do you know if the crash on Android will be fixed with the official release of reanimated v2

Using Reanimated 2 with Expo

We wouldn’t be able to get as many people to try Reanimated 2 if not the support from the Expo team (special thanks to Tomasz Sapeta, Stanisław, Brent and Evan). We are very grateful for the opportunity of incorporating beta version of Reanimated 2 into Expo as early as in SDK 39 which went out in August 2020. We are happy to announce that the stable release of Reanimated will be a part of the next Expo SDK release (41) which will go out in the upcoming weeks.

brentvatne commented 3 years ago

i cloned the repo that @adblanc provided, ran it in Expo Go and it worked as expected, then i ran expo build:android -t apk and installed it the resulting apk in an emulator (pixel 3 api 29) and it also worked. i installed it on my oneplus 6t api 29 and it also worked.

please download the apk and run it on your device: https://exp-shell-app-assets.s3.us-west-1.amazonaws.com/android/%40notbrent/r2-test-e22670de13fe4a8aa1ac271f62c21d76-signed.apk

if you can reproduce it in an emulator, please let me know the avd configuration.


for people seeing the turbomodules related crash, please remember that you should not use the "turboModules": true flag in app.json! turbomodules are not used on the latest version of reanimated and enabling turbomodules is likely to cause problems in your app.

we have a pr open already to update to reanimated v2 stable (https://github.com/expo/expo/pull/12039) but i'd love to be able to get more info on what is going on here so i can reproduce and see if the issue is fixed.

msevestre commented 3 years ago

@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?

brentvatne commented 3 years ago

you're right, closing and reopening it reproduces this issue, thank you @msevestre!

msevestre commented 3 years ago

@brentvatne awesome. When you have a fix, I'll be happy to try it out again to verify. Good luck 🤞

kmagiera commented 3 years ago

Just CCing @Szymon20000 here as he may have some time to look into this issue after 3/15

msevestre commented 3 years ago

@brentvatne @Szymon20000 Any news on that by any chance?

brentvatne commented 3 years ago

i have tested this on sdk 41 (which is close to entering beta) and been unable to reproduce this issue. you can try this apk on your device to verify: https://github.com/brentvatne/files/raw/master/apks/reanimated2sdk41.apk.zip

claraberendsen commented 3 years ago

I have a similar issue with expo SDK 40 with Reanimated2. I followed the steps as described here and in expo docs to add and have the following error. Error: If you want to use Reanimated 2 then go through our installation steps https://docs.swmansion.com/react-native-reanimated/docs/installation

photo5114309475845646597

brentvatne commented 3 years ago

@claraberendsen - you're missing the babel plugin, see https://docs.expo.io/versions/v40.0.0/sdk/reanimated/#installation

adblanc commented 3 years ago

i have tested this on sdk 41 (which is close to entering beta) and been unable to reproduce this issue. you can try this apk on your device to verify: https://github.com/brentvatne/files/raw/master/apks/reanimated2sdk41.apk.zip

Couldn't reproduce it either with your apk, excited to upgrade to SDK 41 :smile:

brandtnewlabs commented 3 years ago

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'] } }

adblanc commented 3 years ago

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

brandtnewlabs commented 3 years ago

@adblanc Not sure if it's different. I used SDK 40 before and had the issue coming up in Sentry too. I then updated to the latest SDK BETA 41 in hope of a fix but it didn't help. Same issue in Sentry.

PhoenixCreation commented 3 years ago

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.

brandtnewlabs commented 3 years ago

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 😊

PhoenixCreation commented 3 years ago

My solution was to create a new App without Expo 🙄

@brandtnewww What are the steps for managed workflow? If possible without android studio (I know it sounds strange but if possible). With android studio will be appreciated too.

brentvatne commented 3 years ago

@brandtnewww - can you provide a minimal repro that i can clone and run? i just took the example from the OP, updated it to sdk 41, did expo build:android -t apk, installed it to emulator and opened, reopened it about 10 times and it worked as expected.

https://github.com/brentvatne/reanimated2-crash-repo apk: https://exp-shell-app-assets.s3.us-west-1.amazonaws.com/android/%40notbrent/r2-test-3a1fc75e3de14af2b394f413818105db-signed.apk

https://user-images.githubusercontent.com/90494/115441394-a7285680-a1c5-11eb-9c8a-125c38ba9904.mov


another option is to eas build to create your standalone app builds. we'll be talking about this soon but it's possible to do this in sdk 41. in this case, the result would be exactly the same as if you included reanimated 2 in any react-native project (minus hermes).

here's an apk for the same app but built with eas build: https://turtle-v2-artifacts.s3.amazonaws.com/android/477db6d8-aa1f-4490-b18b-e7baebd2a026-519b558631a54fe78a24095da0d04e75.apk -- if you have trouble with the first apk, let me know if you observe the same issues on this one

adblanc commented 3 years ago

@brentvatne using the same phone as mentioned firstly, experiencing crashes with the non-eas build but eas build works flawlessly :smile:

brentvatne commented 3 years ago

@adblanc - that's great to know. does it crash often on that phone? thanks for verifying!

adblanc commented 3 years ago

@brentvatne no problem, it depends but right now it crashed 7 times out of 10 attempts

kaisiant commented 3 years ago

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'] } }

Having the same issue, crashed on android expo go and standalone

"expo": "^41.0.0", "react-native-reanimated": "~2.1.0",

PhoenixCreation commented 3 years ago

@brentvatne what is problems in this repo? https://github.com/phoenixcreation/crash-check-expo

This is total changes done on blank template. https://github.com/PhoenixCreation/crash-check-expo/commit/52c2de2213064f7b6e56ab7189ce62259d14bef7

I ran expo build:android -t apk and created apk. this is apk link: https://exp-shell-app-assets.s3.us-west-1.amazonaws.com/android/%40phoenixcreation/crash-check-81c8c976186445a8acbd144c1fe98c7c-signed.apk

It is crashing on start on physical device. Can you check this please. Thanks in advance.

brentvatne commented 3 years ago

@PhoenixCreation - that looks fine but it's the first time i am seeing a link to that repo 😅 you previously shared a link to a repo with a ton of unrelated code. we're investigating this issue now.

brentvatne commented 3 years ago

we will be deploying the fix from #12650 this afternoon

outaTiME commented 3 years ago

@brentvatne That's such good news, we simply have to create a new build after this afternoon for this change to take place? or are you going to let us know again?

brentvatne commented 3 years ago

i'll let you know when it's live

brentvatne commented 3 years ago

will leave issue open until fix is deployed

brentvatne commented 3 years ago

@outaTiME @adblanc - can you try this apk? https://exp-shell-app-assets.s3.us-west-1.amazonaws.com/android/%40notbrent/r2-test-dd964ba6d3bd400792e7426e943b9a83-signed.apk

superyarik commented 3 years ago

@brentvatne i have same issue like TS on my galaxy S7, but your app working

adblanc commented 3 years ago

@brentvatne this apk works perfectly, opened it ~20 times and didn't see any crash :smiley:

brentvatne commented 3 years ago

@adblanc - great! this is in production now. give it a try with expo build

outaTiME commented 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 🙌

outaTiME commented 3 years ago

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'] } }

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

image

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

brentvatne commented 3 years ago

ota update shouldn't impact it, unless the ota update was missing the reanimated 2 plugin. maybe worth reporting this to the reanimated 2 repository as at this point i believe we are initializing everything correctly.

outaTiME commented 3 years ago

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