Hanzala
Hanzala

Reputation: 1983

Activity crashing with 'java.lang.IllegalStateException'

I developed an app it Kotlin and published it on Playstore after testing it was working perfectly on all tested devices but on Play console I got this error in bulk but I'm helpless to find the reason of this error from anywhere I think that there is bug in OS 8.0 because 99% errors are in android 8.0 please help me to get rid of it

java.lang.IllegalStateException:
at android.support.v4.app.FragmentManagerImpl.saveAllState (FragmentManager.java:2960)
at android.support.v4.app.FragmentController.saveAllState (FragmentController.java:134)
at android.support.v4.app.FragmentActivity.onSaveInstanceState (FragmentActivity.java:591)
at android.support.v7.app.AppCompatActivity.onSaveInstanceState (AppCompatActivity.java:510)
at android.app.Activity.performSaveInstanceState (Activity.java:1487)
at android.app.Instrumentation.callActivityOnSaveInstanceState (Instrumentation.java:1318)
at android.app.ActivityThread.callCallActivityOnSaveInstanceState (ActivityThread.java:5489)
at android.app.ActivityThread.performStopActivityInner (ActivityThread.java:4777)
at android.app.ActivityThread.handleStopActivity (ActivityThread.java:4851)
at android.app.ActivityThread.access$1400 (ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1850)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:148)
at android.app.ActivityThread.main (ActivityThread.java:7406)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)

I tried several things but nothing helpful and only received from play console not during any testing

There is not any crash in my code specifically.

EDIT

I got another relevant error which is occurring in onCreate method of my MainTabbedActivity

that is

java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3256)
at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3352)
at android.app.ActivityThread.access$1100 (ActivityThread.java:223)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1797)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:158)
at android.app.ActivityThread.main (ActivityThread.java:7231)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
Caused by: java.lang.IllegalStateException:
at android.support.v4.app.FragmentManagerImpl.restoreAllState (FragmentManager.java:3142)
at android.support.v4.app.FragmentController.restoreAllState (FragmentController.java:158)
at android.support.v4.app.FragmentActivity.onCreate (FragmentActivity.java:344)
at android.support.v7.app.AppCompatActivity.onCreate (AppCompatActivity.java:85)
at com.gpstrack.mapsnavigation.location.ui.view.MainTabbedActivity.onCreate (MainTabbedActivity.kt:68)
at android.app.Activity.performCreate (Activity.java:6877)
at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1136)
at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3209)

Upvotes: 1

Views: 678

Answers (1)

Hanzala
Hanzala

Reputation: 1983

After too much updates, experiments and getting bundle of crashes I found a solution for this crash that is from AdMob AdActivity which is creating problem when device changes it's orientation so I added these lines in AndroidManifest.xml:

<activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        tools:replace="android:theme" />

Issue resolved and my App is crash free now

Upvotes: 2

Related Questions