question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Crash on app launch

See original GitHub issue

Hello,

I have encountered a problem while using react-native-screens combine with react-navigation : sometimes the app crash when I launched it (tested on Android only). This is the error catch in Logcat in Android Studio :

 Process: com.XXXX, PID: 30449
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.XXXX/com.XXXX.MainActivity}: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.Screen$ScreenFragment: calling Fragment constructor caused an exception
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2825)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2900)
    at android.app.ActivityThread.-wrap11(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:251)
    at android.app.ActivityThread.main(ActivityThread.java:6589)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
 Caused by: androidx.fragment.app.Fragment$InstantiationException: Unable to instantiate fragment com.swmansion.rnscreens.Screen$ScreenFragment: calling Fragment constructor caused an exception
    at androidx.fragment.app.Fragment.instantiate(Fragment.java:532)
    at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57)
    at androidx.fragment.app.FragmentManagerImpl$6.instantiate(FragmentManagerImpl.java:2848)
    at androidx.fragment.app.FragmentState.instantiate(FragmentState.java:85)
    at androidx.fragment.app.FragmentManagerImpl.restoreSaveState(FragmentManagerImpl.java:2485)
    at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:195)
    at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:288)
    at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:106)
    at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:51)
    at com.XXXX.MainActivity.onCreate(MainActivity.java:14)
    at android.app.Activity.performCreate(Activity.java:6975)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2900) 
    at android.app.ActivityThread.-wrap11(Unknown Source:0) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601) 
    at android.os.Handler.dispatchMessage(Handler.java:105) 
    at android.os.Looper.loop(Looper.java:251) 
    at android.app.ActivityThread.main(ActivityThread.java:6589) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
 Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
    at androidx.fragment.app.Fragment.instantiate(Fragment.java:514)
    at androidx.fragment.app.FragmentContainer.instantiate(FragmentContainer.java:57) 
    at androidx.fragment.app.FragmentManagerImpl$6.instantiate(FragmentManagerImpl.java:2848) 
    at androidx.fragment.app.FragmentState.instantiate(FragmentState.java:85) 
    at androidx.fragment.app.FragmentManagerImpl.restoreSaveState(FragmentManagerImpl.java:2485) 
    at androidx.fragment.app.FragmentController.restoreSaveState(FragmentController.java:195) 
    at androidx.fragment.app.FragmentActivity.onCreate(FragmentActivity.java:288) 
    at androidx.appcompat.app.AppCompatActivity.onCreate(AppCompatActivity.java:106) 
    at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:51) 
    at com.XXXX.MainActivity.onCreate(MainActivity.java:14) 
    at android.app.Activity.performCreate(Activity.java:6975) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2900) 
    at android.app.ActivityThread.-wrap11(Unknown Source:0) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1601) 
    at android.os.Handler.dispatchMessage(Handler.java:105) 
    at android.os.Looper.loop(Looper.java:251) 
    at android.app.ActivityThread.main(ActivityThread.java:6589) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
 Caused by: java.lang.IllegalStateException: Screen fragments should never be restored

I didn’t have this issue when I was using react-native-screens 1.0.0-alpha.22 with react-navigation 3.11.0 on react-native 0.59.4 .

I don’t really know what could be the cause of this issue. I didn’t have it before upgrading and it only appears sometimes.

My setup: react-native: 0.60.5 react-navigation: 4.0.7 react-native-screens: 2.0.0-alpha.3 OS: Android 8.0.0 Device: real

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:17
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

14reactions
ArrudaWillyancommented, Sep 22, 2020

@Alaa-Ben @vivekraj I tried all the solutions presented here for both navigation and flipper. I have version 0.63.2 and my problem persists, any solution?

10reactions
vivekrajcommented, Sep 28, 2019

I’m getting similar issue after installing react-native-screens. The app still works by removing the package.

Error and Warning log

Unexpected CPU variant for X86 using defaults: x86
java.lang.ClassNotFoundException: com.facebook.flipper.ReactNativeFlipper
 at java.lang.Class.classForName(Native Method)
 at java.lang.Class.forName(Class.java:453)
 at java.lang.Class.forName(Class.java:378)
 at com.themealsapp.MainApplication.initializeFlipper(MainApplication.java:61)
 at com.themealsapp.MainApplication.onCreate(MainApplication.java:46)
 at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1154)
 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5871)
 at android.app.ActivityThread.access$1100(ActivityThread.java:199)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
 at android.os.Handler.dispatchMessage(Handler.java:106)
 at android.os.Looper.loop(Looper.java:193)
 at android.app.ActivityThread.main(ActivityThread.java:6669)
 at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.flipper.ReactNativeFlipper" on path: DexPathList[[zip file "/data/app/com.themealsapp-C0f4b-llUrryqdD-GckZoQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.themealsapp-C0f4b-llUrryqdD-GckZoQ==/lib/x86, /data/app/com.themealsapp-C0f4b-llUrryqdD-GckZoQ==/base.apk!/lib/x86, /system/lib]]
 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
 ... 15 more
Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
Accessing hidden method Ldalvik/system/CloseGuard;->get()Ldalvik/system/CloseGuard; (light greylist, reflection)
Accessing hidden method Ldalvik/system/CloseGuard;->open(Ljava/lang/String;)V (light greylist, reflection)
Accessing hidden method Ldalvik/system/CloseGuard;->warnIfOpen()V (light greylist, reflection)
Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
ReactNative: Packager connection already open, nooping.
Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
Verification of void androidx.appcompat.widget.AppCompatTextHelper.updateTypefaceAndStyle(android.content.Context, androidx.appcompat.widget.TintTypedArray) took 119.172ms
Accessing hidden method Landroid/widget/TextView;->getTextDirectionHeuristic()Landroid/text/TextDirectionHeuristic; (light greylist, linking)
Attempting to set client state on removed layer: Splash Screen com.themealsapp#0
Attempting to destroy on removed layer: Splash Screen com.themealsapp#0
Verification of void androidx.core.content.res.ResourcesCompat$FontCallback$2.<init>(androidx.core.content.res.ResourcesCompat$FontCallback, int) took 112.184ms
ReactNative: Packager connection already open, nooping.
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.checkbox.ReactCheckBoxManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
FATAL EXCEPTION: mqt_native_modules
Process: com.themealsapp, PID: 15671
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/swiperefreshlayout/widget/SwipeRefreshLayout;
 at com.facebook.react.shell.MainReactPackage.createViewManagers(MainReactPackage.java:185)
 at com.facebook.react.ReactInstanceManager.getOrCreateViewManagers(ReactInstanceManager.java:782)
 at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:184)
 at com.facebook.react.CoreModulesPackage.getModule(CoreModulesPackage.java:152)
 at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:122)
 at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:110)
 at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:188)
 at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:153)
 at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:148)
 at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:479)
 at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:466)
 at com.facebook.react.uimanager.UIManagerHelper.getUIManager(UIManagerHelper.java:31)
 at com.facebook.react.ReactInstanceManager.attachRootViewToInstance(ReactInstanceManager.java:1054)
 at com.facebook.react.ReactInstanceManager.setupReactContext(ReactInstanceManager.java:1012)
 at com.facebook.react.ReactInstanceManager.access$1400(ReactInstanceManager.java:125)
 at com.facebook.react.ReactInstanceManager$5$2.run(ReactInstanceManager.java:972)
 at android.os.Handler.handleCallback(Handler.java:873)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:26)
 at android.os.Looper.loop(Looper.java:193)
 at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:225)
 at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.swiperefreshlayout.widget.SwipeRefreshLayout" on path: DexPathList[[zip file "/data/app/com.themealsapp-C0f4b-llUrryqdD-GckZoQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.themealsapp-C0f4b-llUrryqdD-GckZoQ==/lib/x86, /data/app/com.themealsapp-C0f4b-llUrryqdD-GckZoQ==/base.apk!/lib/x86, /system/lib]]
 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
 ... 22 more
  Force finishing activity com.themealsapp/.MainActivity
channel '833f741 com.themealsapp/com.themealsapp.MainActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
channel '833f741 com.themealsapp/com.themealsapp.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
Attempted to unregister already unregistered input channel '833f741 com.themealsapp/com.themealsapp.MainActivity (server)'
Attempting to set client state on removed layer: com.themealsapp/com.themealsapp.MainActivity#0
Attempting to destroy on removed layer: com.themealsapp/com.themealsapp.MainActivity#0

Android Version : 9 [Emulator] React : 16.9.0 React-native : 0.61.1 React-navigation : 4.0.10 React-navigation-stack : 1.9.0 React-navigation-tabs : 2.5.5

I missed something during the Installation.

Fixed the issue by adding below lines to dependencies section in android/app/build.gradle

implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'

Read more comments on GitHub >

github_iconTop Results From Across the Web

App crashing immediately on start up after upgrading to iOS12.
Running fine in simulator but crashes in device. No crash logs recorded. In line error shown after launching the app Thread 1: EXC_BAD_ACCESS...
Read more >
9 Fixes for When Your iPhone Apps Keep Crashing
Then, head to your Home Screen to relaunch the app. 3. Update the App. Developers often release app updates to fix bugs and...
Read more >
Crashes - Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >
How to Fix Crashing Apps on an iPhone or Android?
If you have an app that does not respond when you try to interact with it on your smartphone screen, the traditional fix...
Read more >
Why do my apps keep crashing on Android, How to fix it
How to fix apps that keep crashing on Android · 1. Force stop the app · 2. Restart the device · 4. Reinstall...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found