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 when opening app: ClassCastException: String cannot be cast to Long #783

Closed
cvzi opened this issue Mar 14, 2024 · 2 comments · Fixed by #784
Closed

Crash when opening app: ClassCastException: String cannot be cast to Long #783

cvzi opened this issue Mar 14, 2024 · 2 comments · Fixed by #784
Labels
Milestone

Comments

@cvzi
Copy link

cvzi commented Mar 14, 2024

Describe the bug
When I try to open the app, it immediately crashes before opening.

I think the last thing I did before this started to happen was that I created a new widget

Version Info:

  • App Version: 0.15.12 from F-Droid
  • Android Version: 10
  • Device Model: Motorola Moto G7 power

Relevant Logcat:

4340  I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.forrestguice.suntimeswidget/.SuntimesActivity bnds=[14,149][194,304]} from uid 10213
4340  D ActivityTaskManager: getPreferredLaunchDisplay usersetdisplayid 0 current displayId 0 paramspreferid 0
8665  D MCLOG   : [MC_TriggerHelper] PauseResumeTrigger
1575  I netd    : firewallSetUidRule(2, 10210, 2) <0.05ms>
4340  I chatty  : uid=1000(system) Binder:2059_10 identical 1 line
4340  D ActivityTaskManager: getPreferredLaunchDisplay usersetdisplayid 0 current displayId 0 paramspreferid 0
2608  D ConnectivityService: Blocked status changed to true for 10210(2009) on netId 147
8616  D MCLOG   : [MC_Service] onStartcommand()
2168  E system_server: Invalid ID 0x00000000.
2168  V WindowManager: Changing focus from Window{75f7eca u0 com.teslacoilsw.launcher/com.teslacoilsw.launcher.NovaLauncher} to null displayId=0
 985  D Zygote  : Forked child process 5290
2175  I ActivityManager: Start proc 5290:com.forrestguice.suntimeswidget/u0a241 for activity {com.forrestguice.suntimeswidget/com.forrestguice.suntimeswidget.SuntimesActivity}
5290  W main    : type=1400 audit(0.0:9390): avc: granted { read } for uid=10241 name="u:object_r:net_dns_prop:s0" dev="tmpfs" ino=15054 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:net_dns_prop:s0 tclass=file
5290  E .suntimeswidge: Not starting debugger since process cannot load the jdwp agent.
8665  D MCLOG   : [MC_TriggerHelper] PauseResumeTrigger
4348  W ActivityTaskManager: Request to remove task ignored for non-existent task 378
2168  I WindowManager:   SURFACE show Surface(name=Splash Screen com.forrestguice.suntimeswidget)/@0x9900055 on display:0: Splash Screen com.forrestguice.suntimeswidget
5290  I .suntimeswidge: The ClassLoaderContext is a special shared library.
8616  D MCLOG   : [MC_Service] onStartcommand()
5290  I TIME4A  : Starting Time4A (v4.4.2-2019c published on 2019-09-13)
5290  I TIME4A  : Main-Thread consumed in ms: 7
5290  D localeForLanguageTag: tag: de :: locale: de
5290  I loadLocale: de
5290  D DEBUG   : initDefaults
4340  I WindowManager: Window drawn AppWindowToken{800bc75 token=Token{84e67ac ActivityRecord{fdd715f u0 com.teslacoilsw.launcher/.NovaLauncher t122}}}
5290  D handleIntent: action: android.intent.action.MAIN, data: null
5290  D UpdateAlarms: setAlarm (fullUpdate): März 15, 00:00
5290  D UpdateAlarms: setAlarm (partialUpdate): März 15, 04:48
5290  D DEBUG   : EquinoxCardView updated: position: 105
5290  D AndroidRuntime: Shutting down VM
----  beginning of crash
5290  E AndroidRuntime: FATAL EXCEPTION: main
5290  E AndroidRuntime: Process: com.forrestguice.suntimeswidget, PID: 5290
5290  E AndroidRuntime: java.lang.RuntimeException: Unable to resume activity {com.forrestguice.suntimeswidget/com.forrestguice.suntimeswidget.SuntimesActivity}: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
5290  E AndroidRuntime:        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4420)
5290  E AndroidRuntime:        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4452)
5290  E AndroidRuntime:        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:52)
5290  E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
5290  E AndroidRuntime:        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
5290  E AndroidRuntime:        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2183)
5290  E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:107)
5290  E AndroidRuntime:        at android.os.Looper.loop(Looper.java:241)
5290  E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:7604)
5290  E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
5290  E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
5290  E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
5290  E AndroidRuntime: Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long
5290  E AndroidRuntime:        at android.app.SharedPreferencesImpl.getLong(SharedPreferencesImpl.java:315)
5290  E AndroidRuntime:        at com.forrestguice.suntimeswidget.getfix.LocationHelperSettings.lastAutoLocationRequest(LocationHelperSettings.java:106)
5290  E AndroidRuntime:        at com.forrestguice.suntimeswidget.getfix.LocationHelperSettings.timeSinceLastAutoLocationRequest(LocationHelperSettings.java:101)
5290  E AndroidRuntime:        at com.forrestguice.suntimeswidget.getfix.LocationHelperSettings.lastAutoLocationIsStale(LocationHelperSettings.java:98)
5290  E AndroidRuntime:        at com.forrestguice.suntimeswidget.SuntimesActivity.onResume(SuntimesActivity.java:526)
5290  E AndroidRuntime:        at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1475)
5290  E AndroidRuntime:        at android.app.Activity.performResume(Activity.java:7959)
5290  E AndroidRuntime:        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4410)
5290  E AndroidRuntime:        ... 11 more
5317  I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
4340  W ActivityTaskManager:   Force finishing activity com.forrestguice.suntimeswidget/.SuntimesActivity
8665  D MCLOG   : [MC_TriggerHelper] PauseResumeTrigger
2174  W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2174  W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
5290  I Process : Sending signal. PID: 5290 SIG: 9
8616  D MCLOG   : [MC_Service] onStartcommand()
4348  I ActivityManager: Process com.forrestguice.suntimeswidget (pid 5290) has died: vis+99 TOP
4348  D ActivityManager: makeInactive, ProcessRecord{87f06e 5290:com.forrestguice.suntimeswidget/u0a241}, clear holder.state
 985  I Zygote  : Process 5290 exited due to signal 9 (Killed)
2176  I libprocessgroup: Successfully killed process cgroup uid 10241 pid 5290 in 0ms
8665  D MCLOG   : [MC_TriggerHelper] PauseResumeTrigger
4348  I DropBoxManagerService: add tag=platform_stats_bookmark isTagEnabled=true flags=0x2
2168  W WindowManager: Failed looking up window callers=com.android.server.wm.WindowManagerService.windowForClientLocked:5473 com.android.server.wm.WindowManagerService.removeWindow:1805 com.android.server.wm.Session.remove:176
8616  D MCLOG   : [MC_Service] onStartcommand()
2174  W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.chimera.GmsIntentOperationService$PersistentTrustedReceiver
2174  W BroadcastQueue: Background execution not allowed: receiving Intent { act=android.intent.action.DROPBOX_ENTRY_ADDED flg=0x10 (has extras) } to com.google.android.gms/.stats.service.DropBoxEntryAddedReceiver
2981  V WindowManager: Changing focus from null to Window{75f7eca u0 com.teslacoilsw.launcher/com.teslacoilsw.launcher.NovaLauncher} displayId=0
2168  I WindowManager:   SURFACE show Surface(name=com.android.systemui.ImageWallpaper)/@0x21edca5 on display:0: com.android.systemui.ImageWallpaper
1232  W qti_sensors_hal: processReportInd: lux: 3, ch0: 2, ch1: 1, pData: 13, pOffset: 4
2168  I WindowManager: Window drawn AppWindowToken{800bc75 token=Token{84e67ac ActivityRecord{fdd715f u0 com.teslacoilsw.launcher/.NovaLauncher t122}}}
2168  I WindowManager:   SURFACE show Surface(name=com.teslacoilsw.launcher/com.teslacoilsw.launcher.NovaLauncher)/@0x900a91d on display:0: com.teslacoilsw.launcher/com.teslacoilsw.launcher.NovaLauncher
1232  W qti_sensors_hal: processReportInd: lux: 12, ch0: 6, ch1: 1, pData: 13, pOffset: 4
2167  W ActivityTaskManager: Activity top resumed state loss timeout for ActivityRecord{a7c01f1 u0 com.forrestguice.suntimeswidget/.SuntimesActivity t-1 f}
   0  W swapper/1: type=1400 audit(0.
@cvzi cvzi changed the title Crash when opening app: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long Crash when opening app: ClassCastException: String cannot be cast to Long Mar 14, 2024
@forrestguice
Copy link
Owner

Thanks for reporting this. Its troubling because these are lines I refactored recently. I don't see anything wrong with them though, but did find another problem that might account for the crash.

Have you used the in-app backup/restore functionality? I'm thinking the crash is because one of the settings (a long) has been mistakenly imported as a String. It is one of the prefs used by "current location", so the crash probably only appears after that mode is enabled somewhere.

@cvzi
Copy link
Author

cvzi commented Mar 14, 2024 via email

forrestguice added a commit that referenced this issue Mar 14, 2024
adds missing statement to getPrefTypes; Long types are mistakenly imported as Strings, crashing the app when those values are eventually used. #783
forrestguice added a commit that referenced this issue Mar 14, 2024
removes `GETFIX_TIME` from list of ALL_KEYS; omit this key from backup/restore. #783
@forrestguice forrestguice added this to the v0.15.13 milestone Mar 15, 2024
forrestguice added a commit that referenced this issue Mar 16, 2024
modifies `lastAutoLocationRequest` so that it tolerates the wrong type (a Long as String because of #783).
forrestguice added a commit that referenced this issue Mar 18, 2024
detects #783
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants