SubhamTyagi/android-ocr

Crash on Optionsmenu

datenpunk opened this issue · 6 comments

Hi

if I try to open the setting the app v3.0 crashes. v2.1 works though.

Android 11
LineageOS 18.1

java.lang.ClassCastException: androidx.preference.ListPreference cannot be cast to androidx.preference.SwitchPreference
	at io.github.subhamtyagi.ocr.SettingsActivity$a.A0(Unknown Source:17)
	at lh.O(:3)
	at ye.e(:1)
	at ye.k(:8)
	at se.E(:8)
	at se.Y(Unknown Source:84)
	at se.C(:4)
	at se.w(:3)
	at fe.onStart(:4)
	at d0.onStart(Unknown Source:0)
	at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1435)
	at android.app.Activity.performStart(Activity.java:8018)
	at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3457)
	at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
	at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loop(Looper.java:223)
	at android.app.ActivityThread.main(ActivityThread.java:7664)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Not reproducible at my device.
May be related to Custom Rom.

Could you try this apk?

If this crash then send file(s) from '/Android/data/io.github.subhamtyagi.ocr.dev/files/crashReports/'

Thanks for looking into it.

The Dev-Version did not help.
2022-02-09 19_28_59_crash.txt

However, I found the problem. My phone is set to german. If I switch it english it works. It seems like the non-translatable strings are duplicated in the localized string resource files. For me this results in empty strings. I'll prepare a pull request with a version which works for me.

Can't confirm that anything is solved. App still crashes when opening the settings menu and system language isn't set to English (US).

Can't confirm that anything is solved. App still crashes when opening the settings menu and system language isn't set to English (US).

This fix not yet available on f-droid due to some build problem.