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.
Related
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.
I am attempting to add a main expansion file to my Cordova Android project. Before I can go further, I need to link up two libraries with the project. I am stuck on the following instructions in http://developer.android.com/google/play/expansion-files.html#AboutLibraries:
from a command line, update your project to include the libraries:
Change directories to the /tools/ directory.
Execute android update project with the --library option to add both
the LVL and the Downloader Library to your project. For example:
android update project --path ~/Android/MyApp \
--library ~/android_sdk/extras/google/market_licensing \
--library ~/android_sdk/extras/google/market_apk_expansion/downloader_library
I formatted the first part to match my system (my best understanding of what to do):
android update project --path ~/Documents/AndroidApps/apkext --library ~/Developer/android-sdk-mac_x86/extras/google/market_licensing
I got this error message:
Error: /Users/Steve/Documents/AndroidApps/apkext is not a valid project (AndroidManifest.xml not found).
I don't know how to go further. This being a Cordova app, the AndroidManifest.xml file resides in apkext/platforms/android/ and the apk build for the project is in apkext/platforms/android/ant-build
I have already successfully downloaded the two libraries asked for and they are in the tools/ folder in the path indicated. Am I applying the instructions wrong?
I think you're following instructions intended for a native android application and your project is a multiplatform cordova app.
Either you only want to focus on the android platform and don't want to use cordova CLI anymore (so you'll have to install plugins manually or using plugman) or you want to use the CLI and continue with the cordova project.
In the first case, just focus on the paltforms/adroid part of the project and forget all the rest.
paltforms/adroid contains the android native app.
So for example use
android update project --path ~/Documents/AndroidApps/apkext/platforms/android --library ~/Developer/android-sdk-mac_x86/extras/google/market_licensing
should work better.
In the other case, if you want to keep using the cordova cli, you should build a cordova plugin that would be composed of your libraries, a java class and javascript to call the native code from your cordova app. In that case you just have to configure the plugin to put the libraries in the libs folder.
Anyway, even if you're only interested in android, I think you will have to make a plugin if you want to do something with your libraries?
I have gone through this opencv Android samples link. In this link all the projects has a JNI C++ code which builds the ".so" file automatically and build the project. I need to create a sample project like the above examples, in which the C++ code builds automatically.
I have gone through few tutorials like this, which has steps to build JNI using command line but there is no steps to build it automatically/using eclipse project.
Can any one list out the steps to create a project in eclipse that builds JNI C++ files automatically?
I suggest you can read the article Getting Started with JNI on Android, Windows and Mac. You just need to right-click on your project and select Add Native Support. Then the IDE will automatically build the .so when you save all changes.
I am thinking how to get Android' s support library to include and compile outside Eclipse. I am using Linux as my build environment and I am not using any IDE for creating apps, only the basic Android SDK. I have only come over answers to this question regarding Eclipse, but how can I do it using only Ant and Android SDK?
Assuming that you are not using GridLayout:
Step #1: Copy android-support-v4.jar or android-support-v13.jar from your SDK into the libs/ directory of your project.
Step #2: There is no step #2.
Choose android-support-v13.jar if you are using native fragments (versus the Android Support package's own backport) and you want to use them with things like ViewPager that are part of the Android Support package.
GridLayout makes things a bit more complicated, in that it is an Android library project. You would need to follow the instructions for how to use an Android library project in a command-line project, probably working off of a copy of the official project.
All of this stuff can be found in the extras/ directory of wherever your SDK is installed.
Similar to this automation article http://www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html
Make sure to generate a valid build.xml file for ant/android building android update project --path /path/to/project
then just ant clean debug
You can also checkout the official doc http://developer.android.com/tools/building/building-cmdline.html
I'm using NetBeans for android application. I installed properly (I think) ActionBarSherlock package as android library project. Everything works fine, I can build and run application, but code editor doesn't recognize ABS classes (just look at screenshot, BUILD SUCCESSFUL but errors exists) and code completion doesn't work too.
My configuration:
Stable NetBeans 7.2 with android plugin ver. 1.13
Linux Mint 13 Maya 64 bit, Mate
ActionBarSherlock ver 4.2 (stable)
How I installed ABS:
Download and extract source
From sdk/tools run command:
./android update project -p path_to_ActionBarSherlock/library/
Similar command to connect android project library with my test project (there is similar option in Netbeans IDE but I get error that this is not android library project)
./android update project -l path_to_ActionBarSherlock/library/ -p path_to_my_test_project
I have tried clean and build on both projects but no results. Any idea?
Regards
The way I finally managed to add ActionBarSherlock to my android project on Netbeans was to:
Download the latest version of ActionBarSherlock and unzip it
Go to the subfolder called library and remove the pom.xml file from there (with one of the previous versions it didn't work. I had to first build it, close it and remove not only pom.xml but also some netbeans properties files)
Open that subproject (library) in the Netbeans
Now this project will no longer be seen as a maven project. Netbeans will see it as an Android project. Then I:
Clean&build it
Add it to my-project's library properties (right-click on my-project, properties, library, add, point the proper location of library project). Important here was to copy/move that library project somewhere near my-project. Otherwise it claimed that it cannot open it.
And from now on it works fine.
Key to that thinking was that Netbeans didn't want to add the provided library project cause it saw it as a Maven project. When the pom is deleted, Netbeans no longer sees it as Maven project nut as an Android project and it can without any objections add it as an Android's project library.
Probably there are better solutions, but I didn't find any and that was the only one working for me.
Hope it helps.
You can also make a new Android project, and then copy and paste the needed files in the new project.
So only copy:
libs, res, src, AndroidManifest.xml