Clon1998 / mobileraker

A Flutter mobile app for Klipper/Moonraker
Other
487 stars 55 forks source link

app crashes on first attempt, loads normally 2nd attempt #359

Closed Grafton1046 closed 6 months ago

Grafton1046 commented 6 months ago

Bug Report

Description

Frequently when launching mobile raker it flashes open and then closes out. Tapping the app a second allows it open successfully. As a result I'm getting occasional reminders that the app is crashing.

mobileraker_2024-04-23T20-12-57.log mobileraker_2024-04-23T19-45-03.log mobileraker_2024-04-24T10-17-51.log mobileraker_2024-04-24T10-07-55.log mobileraker_2024-04-24T10-04-02.log

Screenshot_20240424_100357_One UI Home

Steps to Reproduce

Attempt to open app, issue is intermittent

Expected Behavior

App opens to overview panel

Screenshots

If applicable, add screenshots to help explain the problem.

Version Information

Debug Logs

Please attach the log files generated by Mobileraker. You can find them by navigating to the app's settings page, scrolling to the bottom, and pressing the Debug Logs button.

Additional Context

Add any other relevant context about the problem here.


Checklist

To help us diagnose the issue, please ensure you've completed the following steps:

Clon1998 commented 6 months ago

Hey, thanks for reporting that issue. Does this error happen occasionally or all the time? Also, did you try to reset the app's storage yet?

Grafton1046 commented 6 months ago

Hey, thanks for reporting that issue. Does this error happen occasionally or all the time? Also, did you try to reset the app's storage yet?

around once every 3 or so launches, did not, will do that and test.

Clon1998 commented 6 months ago

Hey, thanks for reporting that issue. Does this error happen occasionally or all the time? Also, did you try to reset the app's storage yet?

around once every 3 or so launches, did not, will do that and test.

Thanks! I will look into that. Sadly, logging starts way later and therfore does not provide any useful info. Can you do me a favor and enable crashalytics reporting in the app settings? It should catch the error and report it to me :).

Grafton1046 commented 6 months ago

Hey, thanks for reporting that issue. Does this error happen occasionally or all the time? Also, did you try to reset the app's storage yet?

around once every 3 or so launches, did not, will do that and test.

Thanks! I will look into that. Sadly, logging starts way later and therfore does not provide any useful info. Can you do me a favor and enable crashalytics reporting in the app settings? It should catch the error and report it to me :).

that was turned on already

Clon1998 commented 6 months ago

Greate! I just had a look at the app's vital data, and it seems like this issue is occurring for many Android users! I will push a hotfix later today to see if it helps resolve that issue..

Clon1998 commented 6 months ago

Just pushed 2.6.15 to play store. Let me know if it helps with that issue!

Clon1998 commented 6 months ago

I just build another version (2.6.16) that might resolve the issue. You can download it from github or wait for Google Play to be ready, as downloading from github tends to break the auto-update from Google play.

Turge08 commented 6 months ago

I'm on 2.6.16 and I have what I assume is the same issue. It seems like it happens when trying to launch the app after a period of inacvity.

On my S23 Ultra, if I click on "Optimize Now" in Device Care, it shows that it killed 1 background process. When I try to launch mobileraker afterwards, it crashes immediately. I do have mobileraker set to "Unrestricted" for battery/background use.

Here's the logcat error:


04-28 16:02:18.801 20885 20885 E AndroidRuntime: FATAL EXCEPTION: main
04-28 16:02:18.801 20885 20885 E AndroidRuntime: Process: com.mobileraker.android, PID: 20885
04-28 16:02:18.801 20885 20885 E AndroidRuntime: java.lang.RuntimeException: Unable to resume activity {com.mobileraker.android/com.mobileraker.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mobileraker.android. Make sure to call FirebaseApp.initializeApp(Context) first.
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5427)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5508)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:180)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:230)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:319)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8919)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
04-28 16:02:18.801 20885 20885 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mobileraker.android. Make sure to call FirebaseApp.initializeApp(Context) first.
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at r8.g.o(Unknown Source:56)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at y9.b.d(Unknown Source:3)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at ae.h.n(Unknown Source:21)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at ae.h.g(Unknown Source:1)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at io.flutter.embedding.engine.c$c.i(Unknown Source:18)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at io.flutter.embedding.engine.c.g(Unknown Source:14)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at io.flutter.embedding.android.d.v(Unknown Source:20)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at io.flutter.embedding.android.c.onNewIntent(Unknown Source:13)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.Activity.performNewIntent(Activity.java:8993)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1556)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1569)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:4362)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5392)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        ... 13 more`

Hope this helps to resolve the error.
Clon1998 commented 6 months ago

I'm on 2.6.16 and I have what I assume is the same issue. It seems like it happens when trying to launch the app after a period of inacvity.

On my S23 Ultra, if I click on "Optimize Now" in Device Care, it shows that it killed 1 background process. When I try to launch mobileraker afterwards, it crashes immediately. I do have mobileraker set to "Unrestricted" for battery/background use.

Here's the logcat error:

04-28 16:02:18.801 20885 20885 E AndroidRuntime: FATAL EXCEPTION: main
04-28 16:02:18.801 20885 20885 E AndroidRuntime: Process: com.mobileraker.android, PID: 20885
04-28 16:02:18.801 20885 20885 E AndroidRuntime: java.lang.RuntimeException: Unable to resume activity {com.mobileraker.android/com.mobileraker.MainActivity}: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mobileraker.android. Make sure to call FirebaseApp.initializeApp(Context) first.
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5427)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:5508)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:180)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:98)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2685)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:106)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:230)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:319)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8919)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
04-28 16:02:18.801 20885 20885 E AndroidRuntime: Caused by: java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.mobileraker.android. Make sure to call FirebaseApp.initializeApp(Context) first.
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at r8.g.o(Unknown Source:56)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at y9.b.d(Unknown Source:3)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at ae.h.n(Unknown Source:21)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at ae.h.g(Unknown Source:1)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at io.flutter.embedding.engine.c$c.i(Unknown Source:18)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at io.flutter.embedding.engine.c.g(Unknown Source:14)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at io.flutter.embedding.android.d.v(Unknown Source:20)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at io.flutter.embedding.android.c.onNewIntent(Unknown Source:13)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.Activity.performNewIntent(Activity.java:8993)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1556)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1569)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:4362)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:5392)
04-28 16:02:18.801 20885 20885 E AndroidRuntime:        ... 13 more`

Hope this helps to resolve the error.

Thanks! I also saw that it still occurs on 2.6.16. There is not much I can do as this seems to be caused by the firebase plugin itself. Worst case, I'll need to remove it and write some UI stuff for the firebase login myself...

Turge08 commented 6 months ago

It's been a while since I've developed for Android but perhaps this might help

https://wajahatkarim.com/2020/03/defending-your-app/

Clon1998 commented 6 months ago

Hey, I just started the rollout for the preview/beta of 2.6.19 (android2.6.19)

I removed the dependency that caused this issue entirely. Fell free to download the latest RC vis GitHub or via the Playstore once available and let me know if the issue persists. On my end I'll monitor the vitals provided by Google Play to see if the crash still occurs too.

Clon1998 commented 6 months ago

I'll close this issue as it seems to be resolved.

I slowly rolled out 2.6.19 and monitored the crash reports and can say with confidents that it is fixed as I currently have around 2000 installs without a single error report in google play šŸ„³