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`.

    public class MainActivity extends AppCompatActivity
    {
        @Override
        protected void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            // Attempt to initialize the API.
            TessBaseAPI baseApi = new TessBaseAPI();
    
            // Initialize the language training file path.
            // See 'strings.xml' under 'values' under 'res'.
            String DATA_PATH = getString(R.string.data_path);


            baseApi.init(DATA_PATH, "eng"); // <-- TessAndroid has stopped!
        }
    }


I understand my data_path needs to be a path that exists on my Android 
device.

(Initially, I thought similar to a Unity3D project that copies this file to 
device via StreamingAssets, AndroidStudio would do the same when building 
to device.)

But I cannot seem to find a way to do that... Do I need to do so manually 
using something like AndroidFileTransfer? Or somehow in my AndroidStudio 
code?

How can I use AssetManager to copy the files to the device storage?

J

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/7248109c-d375-4874-8831-03441cf85c44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to