1. Download our Official Android App: Forums for Android!

tess-two Android Studio app has stopped at data path

Discussion in 'Android Devices' started by Joshua Martinez, Aug 6, 2017.

  1. Joshua Martinez

    Thread Starter
    Rank:
    None
    Points:
    16
    Posts:
    12
    Joined:
    Jun 13, 2017

    Jun 13, 2017
    12
    1
    16
    I am starting off simple with `tess-two` in `Android Studio` (after I managed to import the pre-compiled version of `Tesseract` into my project!) so I keep adding single lines and moving forward...

    In `strings.xml` under `values` under `res`, I have defined the following data path:

    <string name="data_path">/usr/local/Cellar/tesseract/3.05.01/share/tessdata/eng.traineddata</string>

    However, the `baseApi.init` line crashes my `Empty Activity` app that would normally build to device and say `Hello World`.

    What am I doing wrong?

    Code (Text):
    1.  
    2.     public class MainActivity extends AppCompatActivity
    3.     {
    4.         @Override
    5.         protected void onCreate(Bundle savedInstanceState)
    6.         {
    7.             super.onCreate(savedInstanceState);
    8.             setContentView(R.layout.activity_main);
    9.  
    10.             // Attempt to initialize the API.
    11.             TessBaseAPI baseApi = new TessBaseAPI();
    12.  
    13.             // Initialize the language training file path.
    14.             // See 'strings.xml' under 'values' under 'res'.
    15.             String DATA_PATH = getString(R.string.data_path);
    16.  
    17.             baseApi.init(DATA_PATH, "eng"); // <-- TessAndroid has stopped!
    18.         }
    19.     }
    20.  
     

    Advertisement

Samsung Galaxy S7

The Samsung Galaxy S7 was launched in 2016 and was one of two devices in the lineup. The device features a 5.1-inch display with a resolution of 2560 x 1440, 4GB of RAM, 32GB of storage, and a 12MP rear camera.

Share This Page

Loading...