SubhamTyagi / android-ocr

Tesseract based OCR for android
Apache License 2.0
365 stars 61 forks source link

BUG: Freezed app after the try to install 3rd language & no possibility to switch languages #88

Closed Moostek closed 7 months ago

Moostek commented 1 year ago

Hello, i allowed multiple languages setting as i wanted to intsall several languages (about 10). I installed and downloaded learning data for 1st and then for 2nd language. When i tried to install 3rd language (i choosed the third language and i clicked "back"), then the OCR app freezed and since this time I am not able open it. The only solution is to reinstalled it.

So it seems that only two languages are functional with OCR. I thought that i can download multiple learning language data and then i can switch between them. But this is not obviously possible. Even i have two languages downloaded there is no way to switch from one to each other. Why? The only way to choose desired language is to go to the settings and select new languages... This is too cumbersome!

Can you fix it, please? I think that it will be great to have downloaded several languages and then to switch in between them.

Thank you.

LineageOS 16.0 (Android 9) / OCR 4.0

bearyjd commented 1 year ago

I have the same issue, but get the crash with two languages.

SD61 commented 1 year ago

join the problem. Even the second one doesn't work.

Azzurite commented 1 year ago

Same, first error is

FATAL EXCEPTION: main
Process: io.github.subhamtyagi.ocr, PID: 5947
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=797, result=0, data=null} to activity {io.github.subhamtyagi.ocr/io.github.subhamtyagi.ocr.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
    at android.app.ActivityThread.deliverResults(ActivityThread.java:5368)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:5407)
    at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67)
    at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7870)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
    at java.util.ArrayList.get(ArrayList.java:439)
    at io.github.subhamtyagi.ocr.MainActivity.t(Unknown Source:8)
    at io.github.subhamtyagi.ocr.MainActivity.s(SourceFile:32)
    at io.github.subhamtyagi.ocr.MainActivity.u(SourceFile:246)
    at io.github.subhamtyagi.ocr.MainActivity.onActivityResult(SourceFile:9)
    at android.app.Activity.dispatchActivityResult(Activity.java:8388)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:5361)
    ... 13 more

And then launching the app gives

FATAL EXCEPTION: main
Process: io.github.subhamtyagi.ocr, PID: 9287
java.lang.RuntimeException: Unable to start activity ComponentInfo{io.github.subhamtyagi.ocr/io.github.subhamtyagi.ocr.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3707)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3864)
    at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
    at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2253)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7870)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
    at java.util.ArrayList.get(ArrayList.java:439)
    at io.github.subhamtyagi.ocr.MainActivity.t(Unknown Source:8)
    at io.github.subhamtyagi.ocr.MainActivity.s(SourceFile:32)
    at io.github.subhamtyagi.ocr.MainActivity.u(SourceFile:246)
    at io.github.subhamtyagi.ocr.MainActivity.onCreate(SourceFile:246)
    at android.app.Activity.performCreate(Activity.java:8057)
    at android.app.Activity.performCreate(Activity.java:8037)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1345)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3688)
    ... 12 more