facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.17k stars 24.32k forks source link

Release APK - App crashes (sometimes) on first launch - No ViewManager found for class RCTText - [New Architecture] [Fabric] [Android] [Crash] #35433

Closed ugurdalkiran closed 1 year ago

ugurdalkiran commented 1 year ago

Description

[New Architecture] [Fabric] [Android] [Crash]

I can develop my application without any problem in development mode. There is no problem at startup. Everything is perfect.

But when I get the release APK and test it, my application sometimes opens without any problems. I can view my View and Text components within the application.

Sometimes, when I click on the application icon, my application suddenly crashes. 😟

Info: Since my development environment is on Windows, I am operating on the "Visual Studio 2022 Developer Command Prompt v17.4.1" terminal. To keep the application path short, I create the application folder as "C:/a07061".

Info: Although it says "newArchEnabled=false" in android/gradle.properties, I can see {fabric: true} in development mode. (This is how it comes in the default react-native install.)

gorsel1

I have shared the log information about this crash and the video of the event below.

Application package name: com.a07061

List of packages installed in my app:

"react": "18.1.0",
"react-native": "0.70.6",
"react-native-reanimated": "3.0.0-rc.6"

App.js content, which is the app first screen.

return (
    <View>
        <Text
        style={{
            backgroundColor: 'tomato',
            padding: 20,
            margin: 20,
            borderRadius: 5,
            color: '#fff',
            fontWeight: 'bold',
            textAlign: 'center',
            fontSize: 18,
        }}>
        Hello 0.70.6
        </Text>
    </View>
);

Video:

https://user-images.githubusercontent.com/27302986/203388374-67a7efdb-819c-4072-8d19-d9a721aa08d5.mp4

Log:

We can focus on the "-------- beginning of crash" part where the crash occurred in the log section. I add that maybe it is important before.

The important point I see in the log is:

FATAL EXCEPTION: fabric_bg
com.facebook.react.uimanager.IllegalViewOperationException: No ViewManager found for class RCTText

Sometimes at the point I run the application it cannot find the View or Text components and the application does not open. :(

11-22 20:43:36.270   515  1453 W InputReader: Device virtio_input_multi_touch_5 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.270   515  1453 W InputReader: Device virtio_input_multi_touch_2 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.270   515  1453 W InputReader: Device virtio_input_multi_touch_8 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.282 11776 11776 D NetworkSecurityConfig: No Network Security Config specified, using platform default
11-22 20:43:36.282 11776 11776 D NetworkSecurityConfig: No Network Security Config specified, using platform default
11-22 20:43:36.289 11776 11776 V fb-UnpackingSoSource: locked dso store /data/user/0/com.a07061/lib-main
11-22 20:43:36.291 11776 11776 I fb-UnpackingSoSource: dso store is up-to-date: /data/user/0/com.a07061/lib-main
11-22 20:43:36.291 11776 11776 V fb-UnpackingSoSource: releasing dso store lock for /data/user/0/com.a07061/lib-main
11-22 20:43:36.293 11776 11776 V SoLoader: libjscexecutor.so not found on /data/data/com.a07061/lib-main
11-22 20:43:36.294 11776 11776 V SoLoader: libjscexecutor.so not found on /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.294 11776 11776 V SoLoader: libjscexecutor.so not found on /vendor/lib
11-22 20:43:36.294 11776 11776 V SoLoader: libjscexecutor.so not found on /system/lib
11-22 20:43:36.295 11776 11776 E SoLoader: couldn't find DSO to load: libjscexecutor.so
11-22 20:43:36.295 11776 11776 E SoLoader:      SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.a07061/lib-main flags = 1]
11-22 20:43:36.295 11776 11776 E SoLoader:      SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86 flags = 0]
11-22 20:43:36.295 11776 11776 E SoLoader:      SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib flags = 2]
11-22 20:43:36.295 11776 11776 E SoLoader:      SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
11-22 20:43:36.295 11776 11776 E SoLoader:      Native lib dir: /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.295 11776 11776 E SoLoader:  result: 0
11-22 20:43:36.295 11776 11776 V SoLoader: libhermes.so not found on /data/data/com.a07061/lib-main
11-22 20:43:36.295 11776 11776 D SoLoader: libhermes.so found on /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.296 11776 11776 D SoLoader: Not resolving dependencies for libhermes.so
11-22 20:43:36.298 11776 11776 V SoLoader: libhermes-executor-debug.so not found on /data/data/com.a07061/lib-main
11-22 20:43:36.298 11776 11776 V SoLoader: libhermes-executor-debug.so not found on /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.298 11776 11776 V SoLoader: libhermes-executor-debug.so not found on /vendor/lib
11-22 20:43:36.299 11776 11776 V SoLoader: libhermes-executor-debug.so not found on /system/lib
11-22 20:43:36.299 11776 11776 E SoLoader: couldn't find DSO to load: libhermes-executor-debug.so
11-22 20:43:36.299 11776 11776 E SoLoader:      SoSource 0: com.facebook.soloader.ApkSoSource[root = /data/data/com.a07061/lib-main flags = 1]
11-22 20:43:36.299 11776 11776 E SoLoader:      SoSource 1: com.facebook.soloader.DirectorySoSource[root = /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86 flags = 0]
11-22 20:43:36.299 11776 11776 E SoLoader:      SoSource 2: com.facebook.soloader.DirectorySoSource[root = /vendor/lib flags = 2]
11-22 20:43:36.299 11776 11776 E SoLoader:      SoSource 3: com.facebook.soloader.DirectorySoSource[root = /system/lib flags = 2]
11-22 20:43:36.299 11776 11776 E SoLoader:      Native lib dir: /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.299 11776 11776 E SoLoader:  result: 0
11-22 20:43:36.299 11776 11776 V SoLoader: libhermes-executor-release.so not found on /data/data/com.a07061/lib-main
11-22 20:43:36.299 11776 11776 D SoLoader: libhermes-executor-release.so found on /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.299 11776 11776 D SoLoader: Not resolving dependencies for libhermes-executor-release.so
11-22 20:43:36.464 11776 11799 V SoLoader: libturbomodulejsijni.so not found on /data/data/com.a07061/lib-main
11-22 20:43:36.464 11776 11799 D SoLoader: libturbomodulejsijni.so found on /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.464 11776 11799 D SoLoader: Not resolving dependencies for libturbomodulejsijni.so
11-22 20:43:36.504   314   314 W EmuHWC2 : validate: layer 125 CompositionType 1, fallback
11-22 20:43:36.505 11776 11802 V SoLoader: libfabricjni.so not found on /data/data/com.a07061/lib-main
11-22 20:43:36.505 11776 11802 D SoLoader: libfabricjni.so found on /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.505 11776 11802 D SoLoader: Not resolving dependencies for libfabricjni.so
11-22 20:43:36.508 11776 11796 D EGL_emulation: eglCreateContext: 0xf1902e70: maj 2 min 0 rcv 2
11-22 20:43:36.510 11776 11796 D EGL_emulation: eglMakeCurrent: 0xf1902e70: ver 2 0 (tinfo 0xf1c71850) (first time)
11-22 20:43:36.511   314   314 W EmuHWC2 : No layers, exit, buffer 0xf3a81190
11-22 20:43:36.516 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
11-22 20:43:36.518 11776 11802 W unknown:ReactContext: initializeMessageQueueThreads() is called.
11-22 20:43:36.518 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
11-22 20:43:36.519   314   314 W EmuHWC2 : validate: layer 125 CompositionType 1, fallback
11-22 20:43:36.519 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
11-22 20:43:36.522 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
11-22 20:43:36.522   314   314 W EmuHWC2 : No layers, exit, buffer 0xf3a81410
11-22 20:43:36.523 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
11-22 20:43:36.524 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
11-22 20:43:36.525 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
11-22 20:43:36.528   313   356 D goldfish-address-space: claimShared: Ask to claim region [0x3f8965000 0x3f92ca000]
11-22 20:43:36.530 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
11-22 20:43:36.531   172   172 I hwservicemanager: getTransport: Cannot find entry android.hardware.graphics.mapper@4.0::IMapper/default in either framework or device manifest.
11-22 20:43:36.531 11776 11796 I Gralloc4: mapper 4.x is not supported
11-22 20:43:36.535   314   314 W EmuHWC2 : validate: layer 125 CompositionType 1, fallback
11-22 20:43:36.540   314   314 W EmuHWC2 : No layers, exit, buffer 0xf3a81190
11-22 20:43:36.541 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
11-22 20:43:36.542 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
11-22 20:43:36.547 11776 11796 D HostConnection: createUnique: call
11-22 20:43:36.548 11776 11796 D HostConnection: HostConnection::get() New Host Connection established 0xf1930050, tid 11796
11-22 20:43:36.548 11776 11796 D goldfish-address-space: allocate: Ask for block of size 0x100
11-22 20:43:36.549 11776 11796 D goldfish-address-space: allocate: ioctl allocate returned offset 0x3f3ffe000 size 0x2000
11-22 20:43:36.549 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
11-22 20:43:36.552   314   314 W EmuHWC2 : validate: layer 125 CompositionType 1, fallback
11-22 20:43:36.552 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
11-22 20:43:36.555   314   314 W EmuHWC2 : No layers, exit, buffer 0xf3a81410
11-22 20:43:36.561 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
11-22 20:43:36.561 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
11-22 20:43:36.562 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
11-22 20:43:36.563 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
11-22 20:43:36.564 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
11-22 20:43:36.565 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
11-22 20:43:36.565 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
11-22 20:43:36.567 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
11-22 20:43:36.574 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
11-22 20:43:36.578 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
11-22 20:43:36.579 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
11-22 20:43:36.580 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
11-22 20:43:36.581 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
11-22 20:43:36.581 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
11-22 20:43:36.581 11776 11801 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.unimplementedview.ReactUnimplementedViewManager
11-22 20:43:36.584 11776 11801 V SoLoader: libreanimated.so not found on /data/data/com.a07061/lib-main
11-22 20:43:36.584 11776 11801 D SoLoader: libreanimated.so found on /data/app/~~OwEQ1esCSBipqj1W844K7A==/com.a07061-Jo2xIy8mv87Ubc4_oW2JLg==/lib/x86
11-22 20:43:36.584 11776 11801 D SoLoader: Not resolving dependencies for libreanimated.so
11-22 20:43:36.624   515   563 D ArtManagerInternalImpl: /data/misc/iorapd/com.a07061/1/com.a07061.MainActivity/compiled_traces/compiled_trace.pb doesn't exist
11-22 20:43:36.624   515   552 D EventSequenceValidator: Transition from ACTIVITY_LAUNCHED to ACTIVITY_FINISHED
11-22 20:43:36.626   515   563 I ActivityTaskManager: Displayed com.a07061/.MainActivity: +416ms
11-22 20:43:36.687 11776 11801 I ReactNativeJS: Running "a07061
--------- beginning of crash
11-22 20:43:36.702 11776 11804 E AndroidRuntime: FATAL EXCEPTION: fabric_bg
11-22 20:43:36.702 11776 11804 E AndroidRuntime: Process: com.a07061, PID: 11776
11-22 20:43:36.702 11776 11804 E AndroidRuntime: com.facebook.react.uimanager.IllegalViewOperationException: No ViewManager found for class RCTText
11-22 20:43:36.702 11776 11804 E AndroidRuntime:        at com.facebook.react.uimanager.ViewManagerRegistry.get(ViewManagerRegistry.java:68)
11-22 20:43:36.702 11776 11804 E AndroidRuntime:        at com.facebook.react.fabric.mounting.MountingManager.measure(MountingManager.java:367)
11-22 20:43:36.702 11776 11804 E AndroidRuntime:        at com.facebook.react.fabric.FabricUIManager.measure(FabricUIManager.java:569)
11-22 20:43:36.702 11776 11804 E AndroidRuntime:        at com.facebook.jni.NativeRunnable.run(Native Method)
11-22 20:43:36.702 11776 11804 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
11-22 20:43:36.702 11776 11804 E AndroidRuntime:        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
11-22 20:43:36.702 11776 11804 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:923)
11-22 20:43:36.707   515  1453 W ActivityTaskManager:   Force finishing activity com.a07061/.MainActivity
11-22 20:43:36.707   515 11806 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
11-22 20:43:36.710   313   356 D goldfish-address-space: claimShared: Ask to claim region [0x3fc965000 0x3fcf68000]
11-22 20:43:36.719   515   548 W InputReader: Device virtio_input_multi_touch_9 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.719   515   548 W InputReader: Device virtio_input_multi_touch_7 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.719   515   548 W InputReader: Device virtio_input_multi_touch_10 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.719   515   548 W InputReader: Device virtio_input_multi_touch_4 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.719   515   548 W InputReader: Device virtio_input_multi_touch_2 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.719   515   548 W InputReader: Device virtio_input_multi_touch_8 is associated with display ADISPLAY_ID_NONE.
11-22 20:43:36.742 11776 11804 I Process : Sending signal. PID: 11776 SIG: 9
11-22 20:43:36.751   294   294 I Zygote  : Process 11776 exited due to signal 9 (Killed)
11-22 20:43:36.751   515  9655 W OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
11-22 20:43:36.754   515   820 I ActivityManager: Process com.a07061 (pid 11776) has died: cch CRE
11-22 20:43:36.754   515   974 I WindowManager: WIN DEATH: Window{b3bc989 u0 com.a07061/com.a07061.MainActivity}
11-22 20:43:36.754   515   974 W InputDispatcher: Attempted to unregister already unregistered input channel 'b3bc989 com.a07061/com.a07061.MainActivity (server)'
11-22 20:43:36.762   515  9655 D EGL_emulation: eglCreateContext: 0xa72c7fd0: maj 2 min 0 rcv 2
11-22 20:43:36.767   515  9655 D EGL_emulation: eglMakeCurrent: 0xa72c7fd0: ver 2 0 (tinfo 0xb9300790) (first time)
11-22 20:43:36.768   515   566 I libprocessgroup: Successfully killed process cgroup uid 10155 pid 11776 in 5ms

Version

0.70.6

Output of npx react-native info

C:\a07061>npx react-native info

info Fetching system and libraries information...
System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Memory: 5.98 GB / 15.69 GB
  Binaries:
    Node: 16.14.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.15 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 8.5.0 - C:\Program Files\nodejs\npm.CMD
    Watchman: Not Found
  SDKs:
    Android SDK:
      API Levels: 25, 28, 30, 31, 32, 33
      Build Tools: 30.0.2, 30.0.3, 31.0.0, 32.0.0, 32.1.0, 33.0.0
      System Images: android-30 | Intel x86 Atom_64, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom_64, android-31 | Intel x86 Atom_64, android-31 | Google APIs Intel x86 Atom_64, android-33 | Google APIs Intel x86 Atom_64, android-33 | Google Play Intel x86 Atom_64
      Android NDK: Not Found
    Windows SDK: Not Found
  IDEs:
    Android Studio: AI-213.7172.25.2113.9014738
    Visual Studio: 17.4.33110.190 (Visual Studio Community 2022)
  Languages:
    Java: 11.0.12 - C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin\javac.EXE
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0
    react-native: 0.70.6 => 0.70.6
    react-native-windows: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

...

Snack, code example, screenshot, or link to a repository

...

cortinico commented 1 year ago

Is this happening on a blank app? Are you able to reproduce it consistently in any form?

ugurdalkiran commented 1 year ago

What is an empty app?

It's actually empty. :) It's a very simple app with just the reanimated package installed and consisting of View and Text components.

cortinico commented 1 year ago

It's actually empty. :) It's a very simple app with just the reanimated package installed and consisting of View and Text components.

Is it crashing also if you remove reanimated? If so, that's a RN issue and we should look into it. If not, we should move this issue to: https://github.com/software-mansion/react-native-reanimated/issues

ugurdalkiran commented 1 year ago

As a result, it cannot find the "RCTText" component, which is a component of the RN.

cortinico commented 1 year ago

As a result, it cannot find the "RCTText" component, which is a component of the RN.

What do you mean with "As a result"?

Could you answer my questions:

Is it crashing also if you remove reanimated? If so, that's a RN issue and we should look into it. If not, we should move this issue to: software-mansion/react-native-reanimated/issues

ugurdalkiran commented 1 year ago

Hi.

I created a clean application (0.70.6) and did not add any packages. In this state, there is no problem when I create a release APK and try it. 🎉

Even if I add a reanimated or just react-native-svg package, that is, add 1 package and use it inside, the release APK sometimes crashes when opening.

cortinico commented 1 year ago

Thanks for the follow up @ugurdalkiran

Even if I add a reanimated or just react-native-svg package, that is, add 1 package and use it inside, the release APK sometimes crashes when opening.

Can you try to create a new package with create-react-native-library: https://github.com/callstack/react-native-builder-bob/blob/main/README.md

And verify if the app crashes?

tangzonglin commented 1 year ago

@ugurdalkiran hi, how did you solve it ?

Sunbreak commented 1 year ago

Fixed by #35770

We could reproduce it in our APP and find the root cause is concurrency of ReactInstanceManager#getOrCreateManager() between CoreModulesPackage#createUIManager() and Fabric's JSIModuleSpec#getJSIModuleProvider()

Screen Shot 2023-07-13 at 14 56 02