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.

java.lang.IllegalStateException

See original GitHub issue

Description

We are having a lot of crashes on Android due to this:

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3780)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3956)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:85)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:135)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:95)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2295)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:246)
  at android.app.ActivityThread.main (ActivityThread.java:8443)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:596)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Caused by: androidx.fragment.app.Fragment$InstantiationException: 
  at androidx.fragment.app.Fragment.instantiate (Fragment.java:566)
  at androidx.fragment.app.FragmentContainer.instantiate (FragmentContainer.java:57)
  at androidx.fragment.app.FragmentManager$3.instantiate (FragmentManager.java:390)
  at androidx.fragment.app.FragmentStateManager.<init> (FragmentStateManager.java:74)
  at androidx.fragment.app.FragmentManager.restoreSaveState (FragmentManager.java:2454)
  at androidx.fragment.app.FragmentController.restoreSaveState (FragmentController.java:196)
  at androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java:287)
  at androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:115)
  at com.facebook.react.ReactActivity.onCreate (ReactActivity.java:44)
  at com.teach.withastrid.MainActivity.onCreate (MainActivity.java:16)
  at android.app.Activity.performCreate (Activity.java:8183)
  at android.app.Activity.performCreate (Activity.java:8167)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1309)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3753)
Caused by: java.lang.reflect.InvocationTargetException: 
  at java.lang.reflect.Constructor.newInstance0 (Native Method)
  at java.lang.reflect.Constructor.newInstance (Constructor.java:343)
  at androidx.fragment.app.Fragment.instantiate (Fragment.java:548)
Caused by: java.lang.IllegalStateException: 
  at com.swmansion.rnscreens.ScreenFragment.<init> (ScreenFragment.java:44)

Has anyone faced/solved a similar issue? Any fixes, tips, workarounds or ideas are more than welcome. Thanks!

Steps To Reproduce

We haven’t reproduced it in dev.

Expected behavior

The app shouldn’t crash.

Actual behavior

The app crashes on Android.

Package versions

  • React: 17.0.1
  • React Native: 0.63.4
  • React Native Screens: 3.3.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
DariuszDyrdacommented, Jun 22, 2021

Bump

0reactions
Sebastian-Jedrochacommented, Jun 22, 2021

Maybe the users have not updated the app since you changed it and that is why you are still getting crash reports. - good point, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix The IllegalStateException in Java - Rollbar
An IllegalStateException is a runtime exception in Java that is thrown to indicate that a method has been invoked at the wrong time....
Read more >
IllegalStateException (Java Platform SE 7 ) - Oracle Help Center
Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is...
Read more >
java - What is IllegalStateException? - Stack Overflow
Usually, IllegalStateException is used to indicate that "a method has been invoked at an illegal or inappropriate time." However, this doesn't look like...
Read more >
How to Solve java.lang.IllegalStateException in Java main ...
IllegalStateException is the child class of RuntimeException and hence it is an unchecked exception. This exception is rise explicitly by ...
Read more >
How to resolve IllegalStateException in Java - Javatpoint
IllegalStateException in Java ... IllegalStateExceptionis the sub-class of RuntimeException class, and therefore it is an unchecked exception. It is raised by the ...
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