I am developing an Android project. In my project, I need to do OCR. So found this tutorial http://www.codeproject.com/Tips/840623/Android-Character-Recognition. I am trying to follow that tutorial. But I am having problems with set up, especially with updating project from terminal (tess-two folder). See what I have done below.
I downloaded tess-two from this link
https://github.com/rmtheis/tess-two/
Then I installed android NDK to build that project
I set environment variable under PATH
Then I run below command in tess two folder from terminal
ndk-build //this took around 30 minutes. I closed command windows after successful built
Then I run this command
android update project --path C:\tess-two-master\tess-two
The problem starts when I run that command because I cannot run android command from terminal. So I found solution from Stack Overflow. I needed to set ANDROID_HOME and environments variable under PATH. Then I tested "android" command and it is working.
Then I run this command again
android update project --path C:\tess-two-master\tess-two
This time, it is giving me this error
How can I solve this error? Why my update command is not working? What is wrong with my code? I am using Windows 64 OS.
This is another way. Installing using Grandle
I tried another way to install tess-two. I installed using Gradle like this according to documentation. But I cannot access to TessDataManager because it cannot be found in project.
Gradle
dependencies {
compile 'com.rmtheis:tess-two:6.0.2'
}
This is error
As you can see, I cannot access to TessDataManager class. How can I import that class?
The tess-two project has been updated to include a pre-compliled AAR that can be incorporated into your app by editing your app's build.gradle file.
This means that you can skip the steps of importing/compiling the library yourself, and follow the usage instructions on the tess-two project. After following the usage instructions, you'll be able to refer to the tess-two classes -- including the TessBaseAPI class -- directly from your project.
Related
There is some issue with android studio. My changes to the native code(library) are not getting effected on rebuild project. Following are the steps I am following.
Remove the existing libraries (rm -r jniLibs/* rm -r obj/local/*)
clean the project
make the project.
Run the app
I have to repeat the above steps 4 to 5 times and then my changes are seen. I am pretty sure I am missing something. Can you guys help me out if i need to change any configuration or something..
Here is the ndk command I am using..
ndk-build NDK_LIBS_OUT=./app/src/main/jniLibs
The above command is building my native code and is properly creating library in jniLibs folder. I am loading this library from my Java source code.
I was trying to build the tesseract ocr library for android studio, i used the tutorilas present on the internet they contains some commands that to be run on cmd. But, the problem is that i am not getting how to exactly run these codes because i have downloaded ndk in my D drive then how will be able to use commands in my project directory. Please anyone tell me steps of running those commands. I have been through so many tutorilas since last three days but still i am not able to build. The commands i have found are,
git clone git://github.com/rmtheis/tess-two tess
cd tess
cd tess-two
ndk-build
android update project --path .
ant release
Building the tess-two project for using Tesseract on Android is unnecessary because there is now a pre-built version available.
If you look at the "Usage" section of the Readme, it shows how to integrate the project with your app as an external dependency by adding a line to the "dependencies" section of your app's build.gradle:
compile 'com.rmtheis:tess-two:6.0.3'
This tells Android Studio to fetch the pre-built version of the library from the remote Maven repository where it has been published.
Once you've done this, you can use the Tesseract API in your app in the same way as if you'd built the library yourself using ndk-build.
I am using Windows 7 x64, cygwin, Eclipse Juno cpp, jre6, android ndk r8b, latest cocos2dx for windows. I have tried this tutorial link.
http://www.cnblogs.com/ybgame/archive/2012/06/07/2540693.html
I have overcome the error. But unfortunately, the Eclipse builder don't generate the .apk file. The console's output is here:
Notice that, there is no "make" command called. This is different from the tutorial link above, where the last part of tutorial, the console's output is showing the make command called.
right click on your Eclipse Project -> Android Tools-> Export signed (or unsigned) Application Package
compile the project in msys or cygwin and then import/ create project from source and give a name. click on the run button.you will notice the project run on emulator all is set . good luck.
this time with a droid related question.
Im running Eclipse Helios and Mac OS X 10.6.8
I have been following a book and a few tutorials on building the NDK from both command line and Eclipse.
I am copying the source over there is no static library business. I can compile from the command line fine with the "ndk-build" executable and it works fine.
Though i need to compile inside Eclipse for the reasons i don't need to go into here.
Ive tried 2 techniques and the one i have seen working is to convert my Project to a c++ project and then in Project / Properties / c/c++ Build tab / Build Command i set to ndk-build , this is set to be visible in my path (hence why it compiles when i go to directory and use ndk-build from Terminal)
I then in the C/C++ General tab add the following locations as include directories :
/Users/Me/Code/Android/android-ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/include
/Users/me/Code/Android/android-ndk-r7b/platforms/android-9/arch-arm/usr/include
/Users/me/Code/Android/android-ndk-r7b/sources/android/native_app_glue
Then when i go to compile i don't get any out put i just get the following error:
Invoking autoreconf in build directory: /Users/me/Code/Android/DroidBlaster
sh -c autoreconf -i
autoreconf: `configure.ac' or `configure.in' is required
Configuration failed with error
Ive tried a few other tutorials but to no avail, if i could award a bounty on this is would as its urgent i get this fixed.
Cheers community :)
NOTE:
Ive worked out that it is using auto tools to build the project where this is incorrect as i should be building with the NDK , getting closer to an answer hopefully. Seems that i cant convert my Android project with CDT to a custom build configuration, might be a bug to do with Eclipse, trying a fresh install
Ok so i worked it out, it was because i was trying to compile using Auto tools when i should have set up the project when i should have been using "Convert to C/C++ project" didn't help though that eclipse installed CDT incorrectly and i had to reinstall to get the right plugins.
I'm trying to build and run the 'Tutorial 2 Advanced - 1. Add Native OpenCV' tutorial built into the opencv package for android. I wasn't able to use the ndk-build from eclipse following the tutorial from http://opencv.itseez.com/trunk/doc/tutorials/introduction/android_binary_package/android_binary_package.html
But, I built the project from cygwin successfully. But then when trying to run as an android application in Eclipse, it has the error
'Description Resource Path Location Type
The project was not built due to "'NUL' is an invalid name on this platform.". Fix the problem, then try refreshing this project and building it since it may be inconsistent Tutorial 2 Advanced - 1. Add Native OpenCV Unknown Java Problem'
Any help would be much appreciated, thanks
What exactly did you build with Cygwin? I've had an error which prevented me from building from the command prompt but with Cygwin everything works fine.
In Cygwin I first navigate to my project folder:
cd /cygdrive/c/"path to your project folder>"/
then while I'm in the project folder type:
/cygdrive/c/"path to android-ndk-r7b folder"/ndk-build
After using these commands I was able to run the Tutorial 2 Advanced - 1. Add Native OpenCV project. Let me know if this helps you?