Reputation: 1319
I am trying to use the tesseract libray for java in my Android application as suggested here: http://vkedco.blogspot.com/2013/03/vladimir-kulyukin-learning-objectives-1.html
I have followed the instructions as it is and I still get an error that says that I need to have the subfolder tessdata in the path. The subfolder does exist in my sdcard/tesseract_languages folder.
Any suggestions about what I should do to get this running?
Error details are given below:
05-13 20:54:35.653: E/AndroidRuntime(11715): FATAL EXCEPTION: main
05-13 20:54:35.653: E/AndroidRuntime(11715): Process: com.example.msapp2, PID: 11715
05-13 20:54:35.653: E/AndroidRuntime(11715): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.msapp2/com.example.msapp2.MainActivity}: java.lang.IllegalArgumentException: Data path must contain subfolder tessdata!
05-13 20:54:35.653: E/AndroidRuntime(11715): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
05-13 20:54:35.653: E/AndroidRuntime(11715): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
05-13 20:54:35.653: E/AndroidRuntime(11715): at android.app.ActivityThread.access$800(ActivityThread.java:135)
05-13 20:54:35.653: E/AndroidRuntime(11715): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
Upvotes: 2
Views: 5741
Reputation: 11
I was facing the same problem. Worked for me when I removed "tessdata" from the path, as yushlx answer.
Before (fail): path = "/mnt/sdcard/tesseract/tessdata"; After (success): path = "/mnt/sdcard/tesseract/";
Of course, tessdata folder should be in the path with the desired.traineddata file.
Upvotes: 0
Reputation: 12140
I met the same issue. When reading the source code, I found:
public boolean init(String datapath, String language) {
if (datapath == null)
throw new IllegalArgumentException("Data path must not be null!");
if (!datapath.endsWith(File.separator))
datapath += File.separator;
File tessdata = new File(datapath + "tessdata");
if (!tessdata.exists() || !tessdata.isDirectory())
throw new IllegalArgumentException("Data path must contain subfolder tessdata!");
return nativeInit(datapath, language);
}
which means don't add "tessdata" to the datapath. The method init() will add it.
Upvotes: 2