Introduction
The AndAR project contains some native C sources. This page describes how to compile those.
Details
Since NDK r4
- Install the android NDK
- (windows only) Install Cygwin
- Open the Cygwin shell or some other shell on a linux system
- Go to the project's folder
- Go to the NDK folder, e.g. cd /cygdrive/c/Users/Tobi/workspace/AndAR/jni
- Invoke the program called ndk-build(found inside the unzipped NDK folder), e.g. /opt/android-ndk-r4/ndk-build
- Refesh your project in Eclipse (right-click -> refresh)
- If everything went smoothly your libs/armeabi folder should contain .so files
Before NDK r4
- Install the android NDK
- (windows only) Install Cygwin
- Open the Cygwin shell or some other shell on a linux system
- Go to the NDK folder.
- This is where you unzipped the android NDK.
- e.g. you unzipped it to C:\cygwin do a cd /android-ndk.
- Create a symlink from your eclipse project folder (should be called AndOpenGLCam) to the ndk apps folder, e.g. ln -s /cygdrive/c/Users/Tobi/workspace/AndAR/ apps/AndAR (adapt the path)
- In the root of the NDK folder run make APP=AndOpenGLCam
- Refesh your project in Eclipse (right-click -> refresh)
- If everything went smoothly your libs/armeabi folder should contain .so files
Any thoughts on supporting ARToolkitPlus 2.2.0 on your project?
I would, if android c++ wasn't that rubish... e.g. it doesn't support the STL
So, some details on getting it to build on my system:
Then you should check this out, since this guy has patched the NDK toolchain to add STL support to it.
Here it is, support of ARToolkitPlus, I made this project page just to put there apk file right now http://code.google.com/p/andarplus/
skrzy84, did you used the patched NDK? How about the ARToolkitPlus version? Is it 2.2? I'm waiting for that source code :)
exactly I used crystax NDK r3 and ARToolkitPlus 2.2.0, I can put it in a few days after clean-up, it will be modified andar from a month or two ago
pushing the camera calibration file to the sdcard is no longer needed.
do we still need to compile the native source for the new AndAR? cause i try to compile and libimageprocessing.so is missing ~
It won't compile under n4. ndk-build throws the following errors:
<workspace>/AndAR/jni/AR/arToolKi t.c:28:21: error: GLES/gl.h: No such file or directory <workspace>/AndAR/jni/AR/arToolKi t.c: In function 'Java_edu_dhbw_andar_ARToolkit_artoolkit_1detectmarkers': <workspace>/AndAR/jni/AR/arToolKi t.c:507: warning: passing argument 4 of 'arGetTransMat' from incompatible pointe r type <workspace>/AndAR/jni/AR/AR/ar.h: 408: note: expected 'double ()4?' but argument is of type 'double ' make: [<workspace>/AndAR/bin/ ndk/local/armeabi/objs/ar/arToolKit.o] Error 1
I have the same problem while compiling the code: at arToolKit.c:510 warning: passing argument 4 of 'arGetTransMat' from incompatible pointer type ... ar.h:408: expected 'double()4?' but argument is of type 'double '
since I'm not getting it. Hopefully somebody is able to explain the problem/solution to me?
I can't get C/C++ debugging in Eclipse to work with andarplus. STL is now supported with the latest NDK. So no need for the crystax mod anymore. First of all, I had to make some modifications to get andarplus to compile: -Move Application.mk to the jni folder. -Change the contents of Application.mk so that it only contains: APP_STL := stlport_shared APP_MODULES := arplus -Add System.loadLibrary("stlport_shared") to each location where a System.loadLibrary call is made. -Remove all header references from all make files at LOCAL_SRC_FILES
After this it compiles fine but the program crashes on my Samsung Nexus S (Android 2.3). So I want to debug it using Eclipse and the Sequoyah plugin. However, I get an error when running ndk-gdb: cp: target '/my/workspace/dir/obj/local/armeabi/gdb.setup' is not a directory /my/workspace/dir/obj/local/armeabi/gdb.setup: no such file or directory.
I managed to get C/C++ debugging to work in Eclipse using a simple hello-world program so I know the setup is ok. Any ideas?
Update to my previous post: The Application.mk file should contain this line: APP_MODULES := arplus ar imageprocessing yuv420sp2rgb not just arplus as posted earlier. Not sure why the latest source (r25) commented this out. But now it crashes at another location: camera.startPreview(); I haven't figured out why it crashes. The error message is: CameraService? Overlay Creation Failed! I am downloading the Android source now to dive deep into the core. To be continued.
Why does this page has absolutely no clue what an "enter" is? I tried both a normal enter and a shift-enter but the formatting is totally broken...
I tried a few other open source projects which draws stuff on top of the camera image. A lot of them crash as well on Android 2.3. The problems is the way the layering is accomplished as there are several different ways to approach this. I have yet to find the "correct" way though.
In any case, I have decided to abandon this project for now. Partly because of lack of activity but mostly because I have found something much better. It is the Qualcomm QCAR API: http://developer.qualcomm.com/dev/augmented-reality They have a plugin for the Unity3d Android graphics engine and it makes it really easy to make amazing AR apps in no time. See this example which I have got to work too. It runs with 60fps on my Nexus S: http://www.youtube.com/watch?v=tNyc9h22lvU&feature=channel_video_title The tracking is way better quality and also way faster then AndAR (not sure about AndARPlus, I could not get it to work on my phone). Anyway, in the process of trying AndARPlus to work I have written a tutorial about how to debug C++ code on Android using Eclipse in Windows XP. You may find it of interest: http://pilotpage.monosock.org/fileadmin/files/Eclipse-cpp-tutorial.pdf
I hope the text formatting (enters) isn't destroyed again...