SubhamTyagi / android-ocr

Tesseract based OCR for android
Apache License 2.0
401 stars 67 forks source link

Crash on Optionsmenu #42

Open datenpunk opened 2 years ago

datenpunk commented 2 years ago

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)
SubhamTyagi commented 2 years ago

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

SubhamTyagi commented 2 years ago

Could you try this apk?

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

datenpunk commented 2 years ago

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.

franconian commented 2 years ago

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

SubhamTyagi commented 2 years ago

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.

franconian commented 2 years ago

Meanwhile the app was updated via f-droid. Unfortunately the result is that the app opens once. After selecting a second language (English beside German) there's no return to main screen, the app crashes and cannot be started anymore no matter what system language settings. :((

Am 1. März 2022 15:34:51 MEZ schrieb Shubham @.***>:

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.

-- Reply to this email directly or view it on GitHub: https://github.com/SubhamTyagi/android-ocr/issues/42#issuecomment-1055507985 You are receiving this because you commented.

Message ID: @.***> -- Gesendet mit K-9 für Android.