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

app crashes when selecting multiple languages #107

Open
TalOrenshtein opened this issue Sep 15, 2023 · 8 comments
Open

app crashes when selecting multiple languages #107

TalOrenshtein opened this issue Sep 15, 2023 · 8 comments

Comments

@TalOrenshtein
Copy link

Steps to reproduce:

  1. Go to settings
  2. Enable the multiple languages toggle
  3. Select 2 or more languages.

As soon as I confirm the languages, the app crash and refuse to open. Log:

java.lang.RuntimeException: Unable to resume activity {io.github.subhamtyagi.ocr/io.github.subhamtyagi.ocr.MainActivity}: java.lang.ArrayIndexOutOfBoundsException: length=130; index=-1
	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4774)
	at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4807)
	at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:57)
	at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
	at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:179)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2307)
	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:7924)
	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:936)
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.onResume(Unknown Source:7)
	at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1570)
	at android.app.Activity.performResume(Activity.java:8474)
	at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4764)
	... 13 more

@muchuelo
Copy link

muchuelo commented Sep 21, 2023

I have exactly the same problem, except the app does not crash immediately after adding extra languages to the list. But it crashes every time I try to start it if multiple languages are selected.

Uninstalled and reinstalled several times to confirm that selection of multiple languages causes the crash.

After a clean install, the app chooses the default language itself, then successfully downloads the training data, and successfully OCR's an image of text, but once you go into the settings and change anything (add multiple languages, or even just change Tesseract quality from Fast to Best) the app does not download training data for selected languages, and once closed, will always crash when trying to start the app again.

@wincentbalin
Copy link
Contributor

Pull request #89 should fix the problem.

@j-lakeman
Copy link

@SubhamTyagi any updates on this?

@hubortje
Copy link

hubortje commented Mar 2, 2024

The issue persists with 4.0 (F-Droid) on GrapheneOS.

type: crash
osVersion: google/husky/husky:14/UQ1A.240205.004/2024022800:user/release-keys
package: io.github.subhamtyagi.ocr:12
process: io.github.subhamtyagi.ocr
processUptime: 80 + 204 ms
installer: org.fdroid.fdroid

java.lang.RuntimeException: Unable to start activity ComponentInfo{io.github.subhamtyagi.ocr/io.github.subhamtyagi.ocr.MainActivity}: java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 130
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3833)
	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3974)
	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2475)
	at android.os.Handler.dispatchMessage(Handler.java:106)
	at android.os.Looper.loopOnce(Looper.java:205)
	at android.os.Looper.loop(Looper.java:294)
	at android.app.ActivityThread.main(ActivityThread.java:8279)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
	at com.android.internal.os.ExecInit.main(ExecInit.java:49)
	at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
	at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:359)
Caused by: java.lang.IndexOutOfBoundsException: Index -1 out of bounds for length 130
	at jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
	at java.util.Objects.checkIndex(Objects.java:359)
	at java.util.ArrayList.get(ArrayList.java:434)
	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:8674)
	at android.app.Activity.performCreate(Activity.java:8652)
	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1461)
	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3815)
	... 14 more

@Thomas-AA
Copy link

Thomas-AA commented Mar 8, 2024

Hi,

I experience the same problem. on release 11 & 12 (v4.0) from f-droid.org

Android 10 / LineageOS

@deadcombo
Copy link

Sign-in to GitHub, go to Actions in this repo, open the latest one and download the .apk under Artifacts.
You can only download it if you're logged in.

@T8RIN
Copy link

T8RIN commented Apr 8, 2024

You can use ImageToolbox

@vishalscodes
Copy link

vishalscodes commented Apr 21, 2024

Same problem here. Here's a recording:

YouCut_20240421_140215254.mp4

EDIT: Upon testing, @deadcombo's answer works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants