I've read all of questions forums and blogs about it but i still have a problem. Firstly, i ticked tess-two as a library also my project's using tess-two as a library. I downloaded Android-NDK and from my project's properties i clicked Builders and then new -> Program then i choose ndk's ndk-build file. By the way my project is Gautam Gupta's project. He'd given project. Link: https://github.com/GautamGupta/Simple-Android-OCR. When i run that project in my phone, application starts and captures photo but when i press save then application gives error below. http://t1307.hizliresim.com/1c/l/qg0rl.png
Looks like you need to download only TessTwo, make sure you have properly setup the environments variables (ANT_HOME, ANDROID_HOME and ANDROID_NDK) so these point to where you have Ant and Android SDKs.
Then it's a matter of building the project by following TessTwo guidance. That you set up the library-project that can be imported.
Don't forget that the line commands must be performed in CygWin. Once the library project is built you should have correct .so files in libs/*. In order to actually use these, you could start with this link.
#Burak:
I have solved my problem. For Windows;
Write the codes below to Cygwin
a.cd <project-path'i>/tess-two
b.export TESSERACT_PATH=${PWD}/external/tesseract-3.01
c.export LEPTONICA_PATH=${PWD}/external/leptonica-1.68
d.export LIBJPEG_PATH=${PWD}/external/libjpeg
e./cygdrive/<ndk-directory>/ndk-build
Write the codes below to CMD
f.android update project --target 1 --path .
g. ant release
Don't forget the "." at step f.
Related
How to use the this for tesseract I found here? I am following the readme in that file, but I don't know how to build the project. Specially I am confused where to type this:
cd tess
cd tess-two
ndk-build
android update project --path .
ant release
I'm not sure if it's gonna work on cmd or do I need something else to build this.
Here are the steps to build:
Download the NDK from the Android Development site and extract it to any folder.
Go to Preferences-->Android -->NDK and select the path for Android-Ndk directory
ex-->D:\Work\Android\Android Tools\android-ndk-r9
Import tess-two project. File -> Import -> Existing Projects into workspace -> tess-two directory.
Right Click on Tess-two--> Properties-->Builders then give any name for Builder like Ndk tess Builder And add location for ndk-build.cmd ex-->:D:\Work\Android\Android Tools\android-ndk-r9\ndk-build.cmd. select working directory as ${Workspace/tess-two}
Refresh tess-two, It will take time to build
After complete build Add it as library:Right click the project, Android Tools -> Fix Project Properties. Right click -> Properties -> Android -> Check Is Library.
You can follow these steps to build tess-two library. In case you face any problem, refer http://mindtherobot.com/blog/452/android-beginners-ndk-setup-step-by-step/
Download and extract android-ndk.
Download cygwin with devel/gcc-core, devel/gcc-c++, devel/gnu, devel/make packages included.
Open cygwin command line and open your tess-two lib path in cygwin using cd command eg. cd /cygwin/c/tess-two-master/tess-two .Then use ndk-build command eg. /cygwin/c/android_ndk-09r/ndk-build. The process of building will start. Note that it will take time to build.
Lastly just import the tess-two libs in eclipse and use it as a library in your project.
Thank you.
If you don't want to build tess-two. You can do all this stuff without downloading android ndk, cygwin and ant. Just follow this blog all things are done already for us we just need to download built files.
I'm looking to incorporate the NDK for C++ code use in my Android project. I'm using Eclipse Android IDE and I've just downloaded android-ndk-r9-darwin-x86_64.tar.bz2 for OSX 64bit. I've uncompressed the ndk and have it in my home folder, but when I attempt to setup the path inside Eclipse prefs, I get this error
I've looked at this similar question (Eclipse error: invalid path for ndk?) for answers, but every suggestion didn't solve the problem. Other relevant information, I have Make 3.8.1, up-to-date SDK, Sequoyah.
I had the same problem and documented the solution to this problem. It are the first 2 steps of the next link you'll need:
http://aplacetogeek.wordpress.com/android-with-opencl-tutorial/
Edit:
The solution is this:
Step 1: setup Android NDK
Download the NDK from:
http://developer.android.com/tools/sdk/ndk/index.html
I unzipped it in the adt-bundle but you can unzip it anywhere you
want.
Note or remember the path you used. I'll need it in the next steps!
Go to Window -> Preferences -> Android -> NDK
Browse to android-ndk-r9c.
Example: /home/dries/AndroidDev/adt-bundle-linux-x86_64-20131030/android-ndk-r9c
Click apply and ok
Step 2: configure Android NDK for your project
Right click on your project folder. Choose android tools -> add
native support (! the bottom one !) and click finish.
The file you just created is going to be your own .so file. This
will be your personal library with the functions you create yourself
in the JNI folder.
Now you should see a JNI folder in your project with a .cpp and an
Android.mk file in it.
Go to project -> properties -> C/C++ build -> build variables -> add
Name: NDKROOT
Value: your android-ndk-r9c folder you also added to NDK in step 1.
Click Ok
Go to C/C++ build and uncheck Use default build path.
Change the
build path to ${NDKROOT}/ndk-build. Make sure you did not end the NDKROOT value on / !
Click apply
You should be able to use the NDK now and compile without errors.
Found a work-around solution to my question with the help from this forum: https://groups.google.com/forum/#!topic/android-ndk/YPFPa9Fen7Y
I downloaded an old copy of the NDK (r5b) and there were no errors when setting up the path, as opposed to r9 the most recent version. As the forum says, the problem lies with Sequoyah which has not updated since 2011 and can not recognize the new structure of that the NDK is laid out in. Hope this helps someone in the future. (If you find a direct solution though, let me know.)
Instead of downloading another version of the NDK, I simply created links inside the build folder to the toolchains, prebuilt and platforms which recreates the folder hierarchy of the r4 NDK.
Doing this made the plugin happy, and I only have one version of the NDK on my computer.
I wanted to try PJSIP on an Android AVD.
I performed the following steps :
Now, the next step says :
Building and running apjsua sample application
We have apjsua sample application located under pjsip-apps/src/apjsua. It is not built by default, and you need SWIG to build it.
Follow these steps to build apjsua:
Make sure SWIG is in the build environment PATH. Alternatively, update
SWIG path in $PJDIR/pjsip-apps/src/apjsua/jni/Android.mk file. Run
ndk-build from directory $PJDIR/pjsip-apps/src/apjsua, note that the
Android NDK root should be in the PATH, e.g:
Create Android project from apjsua. In Eclipse: From menu: File -->
New --> Project Select Android Project from Existing Code, press Next
In Root Directory, put the location of apjsua source code (i.e.
$PJDIR/pjsip-apps/src/apjsua) and press Finish You may need to select
different Android SDK than what is configured in apjsua. You can do
this from the project's Properties. You can modify
apjsua/res/raw/config.txt for apjsua's config file. Run it.
My question is :
How to use swig? I am very confused.
Don't worry about swig. You should compile it, and add it to the environment path.
ndk-build will call swig application. You can add it to the PATH by typing in terminal
PATH=$PATH:/path/to/swig , where /path/to/swig is location on your computer of swig app.
I am trying to setup cocos2dx with eclipse on a MacOs Lion. I am following the tutorial below:
http://www.raywenderlich.com/11283/cocos2d-x-for-ios-and-android-getting-started
When I try and execute the ndk build shell tool i get the following error:
Davids-iMac:~ davidcavanagh$ /Users/davidcavanagh/Downloads/android-ndk-r8b/ndk-build ;
exit;
Android NDK: Could not find application project directory !
Android NDK: Please define the NDK_PROJECT_PATH variable to point to it.
/Users/davidcavanagh/Downloads/android-ndk-r8b/build/core/build-local.mk:130: *** Android
NDK: Aborting . Stop.
logout
[Process completed]
I have tried defining the NDK_PROJECT_PATH through the terminal by using
export NDK_PROJECT_PATH=/Users/davidcavanagh/Downloads/android-ndk-r8b/
This doesn't work. Can anyone help me as I have been stuck on this for ages. Is there a certain way of setting the path that I am not doing?
Thanks
Re-read and re-read again his tutorial. You shouldn't be executing the ndk-build script without supplying the arguments it needs for building your project.
He mentions using the create-android-project.sh script inside the cocos2d-x directory. Make sure you do that, and follow the steps there where you'll supply the project name, reverse-domain application ID (e.g. com.company.project), and so on. This will generate your project directory inside of the cocos2d-x directory, which you can easily & safely move to another location.
Once you have that project set up, you can import it into Eclipse, which, primarily, allows you to build the Android project, but does not refer to the C++ code directly. (You'd need to get CDT and the NDK plugin to actually hook your C++ code up inside of Eclipse).
Otherwise, what's worked for me so far is to run the build_native.sh script inside the project directory whenever I have new code that I want to test on my device. This script references the jni/Android.mk file, where you need to specify your header paths and *.cpp files (similar to how you'd have to specify all of your implementation files with g++ on the command line).
But before you do that, you need to make sure all the environment variables that build_native.sh uses are set up. You can either put them in your ~/.bashrc file, or you can just stick them in that project directory (up to you. bashrc will make them available to all projects whenever you launch a new terminal, whereas hardcoding them into build_native.sh will only offer them to that specific project). I think all you need is to assign the full paths to NDK_ROOT, COCOS2DX_ROOT, and APP_ROOT, and build_native.sh should run successfully.
If you look down at the bottom of build_native.sh, you'll notice an invocation of ndk-build, along with all the necessary parameters that you were missing in your terminal session.
I have just set-up my local jenkins installation on my mac...
Now i have tried to create an ant built which builds my app as soon as i check-in a new change. The ant script is working great as long as i only use it in the project...
cd into the folder
ant release
It is able to find all library projects i'Ve included (ActionBarSherlock, ViewPagerIndicator, NineOldAndroids, HoloEveryWhere, PocketChange)
As soon as i put this on my jenkins installation everything breaks.
My main folder-organisation is like this:
Projects/Project
Projects/ProjectLibrarys/Library
Eclipse referes to those libraries like this: android.library.reference.2=../Project Librarys/ActionBarSherlock/library
I can't use absolute links (because i think they will fix the issue) but eclipse or ant doesn't like them.
I have really no idea how to fix it?
Will i have to edit the build.xml (i've added it into the folder ext/commonbuild/commonbuild.xml so i have the same android build file for all my projects)
If you need more code let me know.
Thanks in advance...
Ok i was able to solve my issue by adding a customproject.properties file with a seperate link for the build.
There is still one issue. It seems that ant doesn't use the customproject.properties for my library project i've added. This library project includes another library project and as soon as i build it has a wrong relative url.
Does someone know how to use the customproject.properties even for the project libraries?
As bluszcz mentioned, I checked out two modules and i was able to build my apk via Jenkins without having two project.properties or customproject.properties file.
On Jenkins Configure Screen, Under Source Code Management - Subversion Modules,
Give the url for your android project (say, SampleAndroidProject)
https://goxxx.com/svn/repository/projects/trunk/SampleAndroidProject
Provide local module directory as 'SampleAndroidProject'
Provide the svn url for your library project (say, google-play-services_lib)
https://goxxx.com/svn/repository/projects/trunk/google-play-services_lib
Provide local module directory as 'google-play-services_lib'
Save and build again.