rmtheis / tess-two

Fork of Tesseract Tools for Android
Apache License 2.0
3.76k stars 1.38k forks source link

Initializing TessBaseAPI crashes app #246

Closed Terry-Kusunoki-Martin closed 6 years ago

Terry-Kusunoki-Martin commented 6 years ago

Summary: I imported tess-two as a module for my project. However, the following block of code, specifically the final line, causes the app to crash.

        TessBaseAPI base_api = new TessBaseAPI();
        String DATA_PATH = "/storage/emulated/0/Download/eng.traineddata";
        String lang = "eng";
        base_api.init(DATA_PATH, lang);

Tess-two version: 9.0.0

Android version: 8.1

Phone/device model: ONEPLUS A3000

Link to training data used: https://github.com/tesseract-ocr/tessdata/blob/master/eng.traineddata

I'm not sure if it is the same as Issue #48, as I do not get an error message. The application merely crashes with the addition of this line. Do I need to create a folder in my phone's storage titled "tessdata"?

rmtheis commented 6 years ago

Yes, and you also need to handle Runtime Permissions if your targetSdkVersion is 23+.

doduythao commented 5 years ago

@Terry-Kusunoki-Martin I get terminated the same no log error. I tried to create sub folder and check to make sure it exists in the externaldirectory. I also granted permission of the app. Everything is ready but that's it. How did you solve it eventually ?