Zfinix / carrier_info

📱 Carrier Info gets networkType, networkGeneration, mobileCountryCode, mobileCountryCode, e.t.c from both android and iOS devices.
MIT License
34 stars 48 forks source link

Crash on Android, Fatal Exception: java.lang.StackOverflowError: stack size 8192KB #12

Closed wangbo4020 closed 3 years ago

wangbo4020 commented 3 years ago

Crash on Android.

carrier_info: 2.0.1

Fatal Exception: java.lang.StackOverflowError: stack size 8192KB
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at com.chizi.carrier_info.CarrierInfoPlugin.onDetachedFromActivity(CarrierInfoPlugin.kt:51)
       at io.flutter.embedding.engine.FlutterEngineConnectionRegistry.detachFromActivity(FlutterEngineConnectionRegistry.java:389)
       at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onDetach(FlutterActivityAndFragmentDelegate.java:560)
       at io.flutter.embedding.android.FlutterActivity.release(FlutterActivity.java:595)
       at io.flutter.embedding.android.FlutterActivity.onDestroy(FlutterActivity.java:616)
       at android.app.Activity.performDestroy(Activity.java:8251)
       at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1364)
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5294)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5339)
       at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2246)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:233)
       at android.app.ActivityThread.main(ActivityThread.java:8010)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:631)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:978)
wangbo4020 commented 3 years ago

Recursive call, Please modify it like this then publish, come on


line 41    override fun onDetachedFromActivityForConfigChanges() {
line 42 -    handler?.setActivity(null)
line 42 +    onDetachedFromActivity()
line 43    }
line 50    override fun onDetachedFromActivity() {
line 51 -    onDetachedFromActivity()
line 51 +    handler?.setActivity(null)
line 52    }
nickwri commented 3 years ago

I'm seeing this as well. I've tested the fix suggested above by wangbo4020 and I can confirm that it works. Please release this asap - thank you.

Zfinix commented 3 years ago

Fixed

alectogeek commented 3 years ago

Does it cause the app to crash? I mean is the app closed on user's device when this occurs?

alectogeek commented 3 years ago

@wangbo4020 @nickwri @Zfinix sorry for disturbing you, but I have a production app that has crash reports on Firebase crashlytics because of this. It is important to know if it fully crashes the app and closes it

nickwri commented 3 years ago

On my app, if i hit the back button to close the app, the problem occurs. If i then resume the app it just hangs and then crashes.

alectogeek commented 3 years ago

What about just sending the app to the background? Does it continue to work when opened again?

Zfinix commented 3 years ago

The Fix above https://github.com/Zfinix/carrier_info/issues/12#issuecomment-898611448 has been implemented in 2.0.2 was a bug from a global replace done I'm sorry.