expo: SDK 39 Renanimated V2 android standalone apk crashing on load

🐛 Bug Report

Summary of Issue

When building an apk using Expo SDK 39 with the reanimated V2 Configuration, the standalone app will not open and crashes.

Edit(2020-10-08): This seems to be not specific to building the apk. But simply running the app in production mode (i.e. expo start --no-dev) should crash on load.

Environment - output of expo diagnostics & the platform(s) you’re targeting

OS: Windows

Expo CLI 3.27.13 environment info: System: Binaries: Node: 12.14.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.13.4 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 4.0.0.0 AI-193.6911.18.40.6626763 npmPackages: expo: ~39.0.0 => 39.0.3 react: ~16.13.0 => 16.13.1 react-dom: ~16.13.0 => 16.13.1 react-native: https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz => 0.63.2 react-native-web: 0.13.13 => 0.13.13 Expo Workflow: managed

Reproducible Demo

I initially found this when trying to migrate my own project, but the same issue is reproduceable in the ‘with-reanimated2’ create react native app template. Note this works fine running locally off an expo start.

Note: I am not able to test if this works on iOS.

Steps to Reproduce

  1. run npx create-react-native-app --template with-reanimated2
  2. expo build:android
  3. install .apk on emulator/phone
  4. open app

Expected Behavior vs Actual Behavior

The app crashes while opening. And I got the following from an ‘adb logcat *:E’ on my emulator.

10-05 15:21:08.680 27460 27460 E AndroidRuntime: FATAL EXCEPTION: main
10-05 15:21:08.680 27460 27460 E AndroidRuntime: Process: com.loganlim.testReanimatedV2, PID: 27460
10-05 15:21:08.680 27460 27460 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:
10-05 15:21:08.680 27460 27460 E AndroidRuntime: exports@23:286
10-05 15:21:08.680 27460 27460 E AndroidRuntime: getEnforcing@27:169
10-05 15:21:08.680 27460 27460 E AndroidRuntime: <unknown>@747:222
10-05 15:21:08.680 27460 27460 E AndroidRuntime: v@2:1473
10-05 15:21:08.680 27460 27460 E AndroidRuntime: <unknown>@746:156
10-05 15:21:08.680 27460 27460 E AndroidRuntime: v@2:1473
10-05 15:21:08.680 27460 27460 E AndroidRuntime: <unknown>@741:5441
10-05 15:21:08.680 27460 27460 E AndroidRuntime: v@2:1473
10-05 15:21:08.680 27460 27460 E AndroidRuntime: <unkno
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at host.exp.exponent.experience.q.F(BaseExperienceActivity.java:7)
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at host.exp.exponent.experience.a.run(Unknown Source:2)
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:907)
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:223)
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7478)
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549)
10-05 15:21:08.680 27460 27460 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
10-05 15:21:08.788   559   642 E InputDispatcher: channel '7198952 com.loganlim.testReanimatedV2/host.exp.exponent.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
10-05 15:21:08.793   559  1825 E SurfaceControl: Call to SurfaceControl.closeTransaction without matching openTransaction

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 18 (7 by maintainers)

Commits related to this issue

Most upvoted comments

we’ll hopefully have an answer for next week, thanks for the info.

Bug found and fixed. 🕵️ The change is being applied to SDK39 Android workers, you may expect it to land in the next 12 hours. 🔜

Bugfix pushed to builders! All builds triggered after Monday, October 26 2020, 18:17 2020 UTC should get the new native backing code allowing you to use Reanimated v2 in standalone apps.

Fix has not been published in a new release of Expo client, so running apps in production mode there will still give you an error.

@Logan-Lim - no update at the moment, sorry for the delays. i’ll try to find someone to investigate this next week.

@brentvatne any updates on this one? I really like Reanimated v2 so far, but depending on timeline might have to revert.

Hey! I noticed that for local development clearing cache with expo start -c flag is enough to get rid of this bug.

The problem still exists for me if I want to publish on the release-channel.

Already tried:

rm -rf $TMPDIR/metro* && expo publish --clear --release-channel my-channel

but results are the same as above.

hi, we’ll look into this

@ivansenic @outaTiME I created a new issue: #11529 - It would be nice if you could upload your crash reports in the new issue so its easier to track

same here, it works well while using expo start and opening android emulator. however in case of running it using expo publish or expo build:android it is failing, Logcat:

NativeReanimated’ could not be found. Verify that a module by this name is registered in the native binary

Please note that installing and running the apk (generated via expo build:android) produce the same error for both physical device or emulator (in compare to expo start+ a that is working fine)

I’m actually able to reproduce this while running locally if I enable production mode.

Expo logs the following error in console (same as reported before): Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeReanimated' could not be found. Verify that a module by this name is registered in the native binary.

@Szymon20000 any ideas on this one?