TessBaseAPI cannot resolve symbol tess-two OCR Android

Jana picture Jana · May 27, 2015 · Viewed 7.3k times · Source

I am trying to run Demo App for OCR using tess-two but i am having problem with code:

I have follow these following steps:

Firstly i have downloaded and install the ndk from here https://developer.android.com/tools/sdk/ndk/index.html. And I configured it successfully Then I Download it "tess-two-master" from here https://github.com/rmtheis/tess-two and i extract it, in that location i run ndk-build command and it compiled successfully also. Then i Open a completely new Android Studio project and follow these instructions https://coderwall.com/p/eurvaq/tesseract-with-andoird-and-gradle from section "Configure tess-two with gradle" In the last step I go in "File -> Project Structure -> Select a module from the left subwindow -> Dependencies (last tab) ->Press the green "+" on your right -> Module Dependency -> OK"

After that i have downloaded this project https://github.com/GautamGupta/Simple-Android-OCR and I copy&paste in my new project the code in these files: "SimpleAndroidOCRActivity.java", "main.xml", "strings.xml". Of course my files had different names (in my case "MainActivity.java", "activity_main.xml", "strings.xml") so some renaming in the code was necessary. I also opened my "AndroidManifest.xml" and I add at the end (but before "/manifest") between "/application" and "/manifest" in the just downloaded "AndroidManifest.xml" (it means that I have add it "uses-permissions" and "uses-feature" tag).

Last step I have downloaded from here https://code.google.com/p/tesseract-ocr/downloads/list the file in the english language. and in the folder of my project excatly in "app-->src-->main". I have created here a new folder and name it "assets". Inside that folder i have created another folder named "tessdata". and i put it there my .traineddata file.

Then when i am trying to sync it, i am having following error: Warning:Dependency OCR3:app:unspecified on project tess-two resolves to an APK archive which is not supported as a compilation dependency. File: C:\Users\jana-PC\AndroidStudioProjects\OCR3\app\build\outputs\apk\app-release-unsigned.apk

When i am trying to compile it, it doesn't compile because it is showing me error that TessBaseAPI cannot resolve symbol:

My code in this part is:

import com.googlecode.tesseract.android.TessBaseAPI;



        TessBaseAPI baseApi = new TessBaseAPI();
        baseApi.setDebug(true);
        baseApi.init(DATA_PATH, lang);
        baseApi.setImage(bitmap);

        String recognizedText = baseApi.getUTF8Text();

        baseApi.end(); 

Anyone with some help, i would be very grateful !!

Answer

LUMI888 picture LUMI888 · May 29, 2015