Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on Production App - java.lang.IllegalStateException #24287

Closed
sroddy opened this issue Nov 13, 2018 · 18 comments
Closed

Crash on Production App - java.lang.IllegalStateException #24287

sroddy opened this issue Nov 13, 2018 · 18 comments
Labels
c: crash Stack traces logged to the console c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. platform-android Android applications specifically

Comments

@sroddy
Copy link
Contributor

sroddy commented Nov 13, 2018

Steps to Reproduce

We have a crash on our production app that started to surface after updating flutter to v0.10.2

It is happening on both android 8.0 and 8.1 on the following devices:

P20 (HWEML)
Mate 20 lite (HWSNE)
FIG-LX1 (HWFIG-H)
Mate 10 Pro (HWBLA)

Logs


java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3173)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3284)
  at android.app.ActivityThread.-wrap12 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1894)
  at android.os.Handler.dispatchMessage (Handler.java:109)
  at android.os.Looper.loop (Looper.java:166)
  at android.app.ActivityThread.main (ActivityThread.java:7383)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:469)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:963)
Caused by: java.lang.IllegalStateException: 
  at io.flutter.view.FlutterMain.ensureInitializationComplete (FlutterMain.java:178)
  at io.flutter.app.FlutterActivityDelegate.onCreate (FlutterActivityDelegate.java:152)
  at io.flutter.app.FlutterActivity.onCreate (FlutterActivity.java:85)
  at com.bendingspoons.live.quiz.MainActivity.onCreate (MainActivity.kt:11)
  at android.app.Activity.performCreate (Activity.java:7362)
  at android.app.Activity.performCreate (Activity.java:7353)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1219)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3126)
@zoechi zoechi added c: regression It was better in the past than it is now c: crash Stack traces logged to the console platform-android Android applications specifically labels Nov 13, 2018
@zoechi zoechi added this to the Goals milestone Nov 13, 2018
@allanwolski
Copy link

Same issue here with the production app.
Samsung Galaxy J5 (j5lte), Android 6.0

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3319)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3415)
  at android.app.ActivityThread.access$1100 (ActivityThread.java:229)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1821)
  at android.os.Handler.dispatchMessage (Handler.java:102)
  at android.os.Looper.loop (Looper.java:148)
  at android.app.ActivityThread.main (ActivityThread.java:7325)
  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 io.flutter.view.FlutterMain.ensureInitializationComplete (FlutterMain.java:178)
  at io.flutter.app.FlutterActivityDelegate.onCreate (FlutterActivityDelegate.java:152)
  at io.flutter.app.FlutterActivity.onCreate (FlutterActivity.java:85)
  at com.bsoft.freteminimo.MainActivity.onCreate (MainActivity.java:10)
  at android.app.Activity.performCreate (Activity.java:6904)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1136)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3266)

@dnfield
Copy link
Contributor

dnfield commented Nov 21, 2018

The logs are helpful - by any chance are you able to reproduce this/know what sequence of events lead to this crash, or are these just coming in from analytics from your users?

@dnfield
Copy link
Contributor

dnfield commented Nov 21, 2018

It looks like this can be caused when the Activity's onCreate gets called without a call to the Application's onCreate.

I think @jason-simmons or @matthew-carroll might know more about how the Android lifecycle could result in this - my rough understanding is that we're getting into a state where the Application is maintained but the Activity is lost (and so is FlutterMain). When the Activity is re-launched, it doesn't find settings and thinks things have gone out of order.

Check was introduced by flutter/engine#5614 but not a ton of context there :(

@dnfield
Copy link
Contributor

dnfield commented Nov 21, 2018

Do you know what version this was working on?

@matthew-carroll
Copy link
Contributor

matthew-carroll commented Nov 22, 2018

@dnfield I don't think its possible for an Activity to be created before the Application class. The Application class is the closest thing in Android to a representation of the process....if the process exists then so does the Application class.

I agree that the error seems to point to initialization not happening. We've seen some reports of this before. But I don't think we were able to root cause the previous instances of this.

@sroddy does this issue only occur on a fresh launch of an app? only on a relaunch of an app? or both?

Are you working with a pure Flutter app, or did you add Flutter to an existing app?

@dnfield
Copy link
Contributor

dnfield commented Nov 22, 2018

Could something be causing the activity to be created a second time, but the application didn't stop running?

@najeira
Copy link
Contributor

najeira commented Nov 28, 2018

similar to #14513

@zoechi
Copy link
Contributor

zoechi commented Dec 13, 2018

Did flutter/engine#5614 fix this?

@zoechi zoechi added waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds engine flutter/engine repository. See also e: labels. labels Dec 13, 2018
@zoechi
Copy link
Contributor

zoechi commented Jan 11, 2019

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

@zoechi zoechi closed this as completed Jan 11, 2019
@allanwolski
Copy link

allanwolski commented Feb 27, 2019

This crash is still recorded by Google Play Console.
It happened 10x in 1 day with the same device.

  • Flutter Channel stable, v1.2.1
  • Android: 8.0, 8.1
  • Devices: Galaxy J6 (j6lte), Galaxy J7 Neo (j7velte), Moto G (5S) (montana)

Logs

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2957)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3032)
  at android.app.ActivityThread.-wrap11 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1696)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6944)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: 
  at io.flutter.view.FlutterMain.ensureInitializationComplete (FlutterMain.java:178)
  at io.flutter.app.FlutterActivityDelegate.onCreate (FlutterActivityDelegate.java:152)
  at io.flutter.app.FlutterActivity.onCreate (FlutterActivity.java:85)
  at com.bsoft.freteminimo.MainActivity.onCreate (MainActivity.java:10)
  at android.app.Activity.performCreate (Activity.java:7183)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1220)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2910)

@gabrc52
Copy link

gabrc52 commented Feb 28, 2019

Also happening on HWDRA-MG on Android 8.1 (#26997)

@lhcdims
Copy link

lhcdims commented May 29, 2019

I can't reproduce this error with my own devices.

Got the following error report from Google Play ANRs & crashes reports @ 2019/05/29:

Today, 01:54 on app version 105
Samsung Galaxy J7 Neo2 (j7topltemtr), Android 8.0
Report 1 of 1
java.lang.RuntimeException: 
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4491)
  at android.app.ActivityThread.handleSendResult (ActivityThread.java:4534)
  at android.app.ActivityThread.-wrap20 (Unknown Source)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1752)
  at android.os.Handler.dispatchMessage (Handler.java:105)
  at android.os.Looper.loop (Looper.java:164)
  at android.app.ActivityThread.main (ActivityThread.java:6944)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:327)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1374)
Caused by: java.lang.IllegalStateException: 
  at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply (DartMessenger.java:124)
  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success (MethodChannel.java:204)
  at com.baseflow.permissionhandler.PermissionHandlerPlugin.processResult (PermissionHandlerPlugin.java:406)
  at com.baseflow.permissionhandler.PermissionHandlerPlugin.handlePermissionsRequest (PermissionHandlerPlugin.java:397)
  at com.baseflow.permissionhandler.PermissionHandlerPlugin.access$000 (PermissionHandlerPlugin.java:34)
  at com.baseflow.permissionhandler.PermissionHandlerPlugin$1.onRequestPermissionsResult (PermissionHandlerPlugin.java:126)
  at io.flutter.app.FlutterPluginRegistry.onRequestPermissionsResult (FlutterPluginRegistry.java:203)
  at io.flutter.app.FlutterActivityDelegate.onRequestPermissionsResult (FlutterActivityDelegate.java:128)
  at io.flutter.app.FlutterActivity.onRequestPermissionsResult (FlutterActivity.java:137)
  at android.app.Activity.dispatchRequestPermissionsResult (Activity.java:7737)
  at android.app.Activity.dispatchActivityResult (Activity.java:7560)
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4487)

@nilsreichardt
Copy link
Contributor

Same problem.

@JakMar17
Copy link

JakMar17 commented Jul 2, 2020

Having same problem in Google Play crashes reports. Cannot preproduced it myself.

java.lang.RuntimeException: 
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4640)
  at android.app.ActivityThread.handleSendResult (ActivityThread.java:4682)
  at android.app.servertransaction.ActivityResultItem.execute (ActivityResultItem.java:49)
  at android.app.servertransaction.TransactionExecutor.executeCallbacks (TransactionExecutor.java:108)
  at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:68)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1957)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7099)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)
Caused by: java.lang.IllegalStateException: 
  at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply (DartMessenger.java:139)
  at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success (MethodChannel.java:231)
  at com.lyokone.location.FlutterLocation.onActivityResult (FlutterLocation.java:164)
  at io.flutter.embedding.engine.FlutterEnginePluginRegistry$FlutterEngineActivityPluginBinding.onActivityResult (FlutterEnginePluginRegistry.java:691)
  at io.flutter.embedding.engine.FlutterEnginePluginRegistry.onActivityResult (FlutterEnginePluginRegistry.java:378)
  at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onActivityResult (FlutterActivityAndFragmentDelegate.java:597)
  at io.flutter.embedding.android.FlutterActivity.onActivityResult (FlutterActivity.java:582)
  at android.app.Activity.dispatchActivityResult (Activity.java:7802)
  at android.app.ActivityThread.deliverResults (ActivityThread.java:4633)

@yoman07
Copy link

yoman07 commented Dec 18, 2020

java.lang.RuntimeException: 
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3556)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3703)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
  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:2216)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:7948)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)
Caused by: java.lang.IllegalStateException: 
  at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.setupFlutterEngine (FlutterActivityAndFragmentDelegate.java:208)
  at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onAttach (FlutterActivityAndFragmentDelegate.java:154)
  at io.flutter.embedding.android.FlutterFragment.onAttach (FlutterFragment.java:582)
  at androidx.fragment.app.Fragment.performAttach (Fragment.java:2574)
  at androidx.fragment.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:828)
  at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState (FragmentManagerImpl.java:1238)
  at androidx.fragment.app.FragmentManagerImpl.moveToState (FragmentManagerImpl.java:1303)
  at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange (FragmentManagerImpl.java:2659)
  at androidx.fragment.app.FragmentManagerImpl.dispatchCreate (FragmentManagerImpl.java:2607)
  at androidx.fragment.app.FragmentController.dispatchCreate (FragmentController.java:235)
  at androidx.fragment.app.FragmentActivity.onCreate (FragmentActivity.java:316)
  at androidx.appcompat.app.AppCompatActivity.onCreate (AppCompatActivity.java:115)
  at androidgecko.com.******.ui.BaseActivity.onCreate (BaseActivity.java:31)
  at android.app.Activity.performCreate (Activity.java:7955)
  at android.app.Activity.performCreate (Activity.java:7944)
  at android.app.Instrumentation.callActivityOnCreate (Instrumentation.java:1307)
  at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:3531)
  at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:3703)
  at android.app.servertransaction.LaunchActivityItem.execute (LaunchActivityItem.java:83)
  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:2216)
  at android.os.Handler.dispatchMessage (Handler.java:107)
  at android.os.Looper.loop (Looper.java:237)
  at android.app.ActivityThread.main (ActivityThread.java:7948)
  at java.lang.reflect.Method.invoke (Method.java)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)

I have the same problem. Any updates for it?

@gabrc52
Copy link

gabrc52 commented Dec 18, 2020

The issue was closed already due to lack of information. But it seems like no one here has reproduced it other than the logs on Google Play Console.

Someone should get one of the devices where the issue occurs or ask someone who has such a device, and do some testing and getting more info.

@pedromassangocode pedromassangocode removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Dec 23, 2020
@jja08111
Copy link

Same issue

Device list

  • Samsung Galaxy S10 5G
  • Samsung Galaxy Note20 Ultra 5G
  • Samsung Galaxy Tab A with S Pen
java.lang.RuntimeException: 
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:4452)
  at android.app.ActivityThread.access$1600 (ActivityThread.java:301)
  at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2159)
  at android.os.Handler.dispatchMessage (Handler.java:106)
  at android.os.Looper.loop (Looper.java:246)
  at android.app.ActivityThread.main (ActivityThread.java:8512)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:602)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1130)
Caused by: java.lang.IllegalStateException: 
  at androidx.media.session.MediaButtonReceiver.onReceive (Unknown Source:74)
  at android.app.ActivityThread.handleReceiver (ActivityThread.java:4443)

@github-actions
Copy link

github-actions bot commented Aug 2, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: crash Stack traces logged to the console c: regression It was better in the past than it is now engine flutter/engine repository. See also e: labels. platform-android Android applications specifically
Projects
None yet
Development

No branches or pull requests