rmtheis/tess-two

Initializing TessBaseAPI crashes app

Terry-Kusunoki-Martin opened this issue · 2 comments

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"?

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

@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 ?