Kudo / react-native-v8

Opt-in V8 runtime for React Native Android
MIT License
924 stars 69 forks source link

react native v0.66.3 with reanimated not supported #92

Open arasrezaei opened 2 years ago

arasrezaei commented 2 years ago

Hi there, thanks for this great package, I tried to test reanimated with V8 but it crushes the app while opening:

FATAL EXCEPTION: create_react_context

java.lang.UnsatisfiedLinkError: dlopen failed: library "libjsc.so" not found

FATAL EXCEPTION: create_react_context
Process: com.qplusv8, PID: 6281
java.lang.UnsatisfiedLinkError: dlopen failed: library "libjsc.so" not found
    at java.lang.Runtime.loadLibrary0(Runtime.java:990)
    at java.lang.System.loadLibrary(System.java:1562)
    at com.swmansion.reanimated.NativeProxy.<clinit>(NativeProxy.java:23)
    at com.swmansion.reanimated.NodesManager.initWithContext(NodesManager.java:138)
    at com.swmansion.reanimated.ReanimatedJSIModulePackage.getJSIModules(ReanimatedJSIModulePackage.java:18)
    at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1336)
    at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:136)
    at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1065)
    at java.lang.Thread.run(Thread.java:761)

I also tried your fork of reanimared (with changing reanimated arr from v0.65 to 0.66 :)) and this time got this error this time:

FATAL EXCEPTION: create_react_context

java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN8facebook15createV8RuntimeERKNSt6__ndk112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE" referenced by "/data/app/com.qplusv8-1/lib/x86/libreanimated.so"...

FATAL EXCEPTION: create_react_context
Process: com.qplusv8, PID: 7478
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "_ZN8facebook15createV8RuntimeERKNSt6__ndk112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE" referenced by "/data/app/com.qplusv8-1/lib/x86/libreanimated.so"...
    at java.lang.Runtime.loadLibrary0(Runtime.java:990)
    at java.lang.System.loadLibrary(System.java:1562)
    at com.swmansion.reanimated.NativeProxy.<clinit>(NativeProxy.java:22)
    at com.swmansion.reanimated.NodesManager.initWithContext(NodesManager.java:127)
    at com.swmansion.reanimated.ReanimatedJSIModulePackage.getJSIModules(ReanimatedJSIModulePackage.java:18)
    at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1336)
    at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:136)
    at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1065)
    at java.lang.Thread.run(Thread.java:761)

is it possible to fix this?

RodolfoGS commented 2 years ago

Try removing exclude "**/libjsc.so" from your android/app/build.gradle

arasrezaei commented 2 years ago

Try removing exclude "**/libjsc.so" from your android/app/build.gradle

Thanks, but with this method Javascript thread runs with V8 and for example reanimated worklets run with JSC. (Am I right?) And having two engines will result in a large app size!

jzxchiang1 commented 2 years ago

I got the same exact error but with v0.65 of react-native-v8. Any help appreciated!

RodolfoGS commented 2 years ago

@Kudo Do you know how to solve this? Thanks

lkinasiewicz commented 2 years ago

@Kudo I have already made the necessary changes here: https://github.com/lkinasiewicz/react-native-reanimated/commits/v8/2.3.1 - the last two commits. Please let me know if you can create v8/2.3.1 branch in your repo so that I can make a pull request, or you can just cherry-pick my changes. I have tested this with RN 0.66.3 and works on Android (v8), Android TV (v8) and iOS (jsc). 0.65.2 should also work, but I haven't checked.

If anybody needs it now, you can use it this way:

jzxchiang1 commented 2 years ago

This is so painful to keep react-native, react-native-reanimated, and react-native-v8 all in sync.

I hope the reanimated team can officially support v8 soon. It's been months and haven't heard anything..

jzxchiang1 commented 2 years ago

0.67 just got published - has anyone tried to see if it works with reanimated?