Ask Your Question
1

OpenCV-2.4.2-android-sdk missing build.xml?

asked 2012-08-16 16:39:13 -0500

Pete gravatar image

updated 2012-08-17 03:11:31 -0500

I am following the tutorial at http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_binary_package_using_with_NDK.html#android-binary-package-with-ndk and found that I have to work round some odd problems. I am using an Android 4.0.3 target and developing on Ubuntu 12.04, I have android-ndk-r8b and am using Android 4.0.3 API 15. I am using Async initialization OpenCV Manager Android service to get OpenCV libraries on the target device. The NDK samples I have tried seem to work ok but all the OpenCV samples fail on the target with either - E/Sample::SurfaceView(1724): Can't open camera! OR

E/CAMERA_ACTIVITY(2076): Could not read /proc/self/smaps 08-16 21:29:33.817: D/CAMERA_ACTIVITY(2076): CameraWrapperConnector::connectToLib: folderPath=/data/data/com.NativeCamera/lib/ 08-16 21:29:33.817: E/CAMERA_ACTIVITY(2076): CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library 08-16 21:29:33.817: E/CV_CAP(2076): Native_camera returned opening error: 4 08-16 21:29:33.825: E/Sample-ImageManipulations::SurfaceView(2076): Failed to open native camera

I dropped back to command line from Eclipse to try and work out what in the environment was failing and I get an error .../android-sdk-linux/tools/ant/build.xml:569: Invalid file: .../OpenCV-2.4.2-android-sdk/sdk/java/build.xml because OpenCV-2.4.2-android-sdk/sdk/java/build.xml does not exist in the released sdk

Following appears to works ok: android update project -p . -s --target 1 ndk-build -B V=1

But then ant debug fails - [dependency] API<=15: Adding annotations.jar to the classpath. [echo] ---------- [echo] Building Libraries with 'debug'...

BUILD FAILED .../android-sdk-linux/tools/ant/build.xml:569: Invalid file: .../OpenCV-2.4.2-android-sdk/sdk/java/build.xml

Eclipse does not show this error so I am not sure what is going on or how best to tackle this problem... Perhaps I should build OpenCV with my environment - that surely would create /OpenCV-2.4.2-android-sdk/sdk/java/build.xml

edit retag flag offensive close merge delete

Comments

Getting a bit closer to the solution, back with Eclipse. On target I find that the same sample fails with D/CAMERA_ACTIVITY( 1796): CameraWrapperConnector::connectToLib: folderPath=/data/data/com.NativeCamera/lib/ E/CAMERA_ACTIVITY( 1796): CameraWrapperConnector::connectToLib ERROR: cannot dlopen camera wrapper library E/CV_CAP ( 1796): Native_camera returned opening error: 4 E/Sample::SurfaceView( 1796): Failed to open native camera And on my target device there is no /data/data/com.NativeCamera/... And if I start my camera I get

cmp=com.ti.omap4.android.camera/.Camera} from pid 525 I/ActivityManager( 312): Start proc com.ti.omap4.android.camera for activity com.ti.omap4.android.camera/.Camera: pid=2028 uid=10007 gids={1006, 1015}

So perhaps my camera does not use the native api

Pete gravatar imagePete ( 2012-08-17 10:01:18 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2012-08-24 16:58:22 -0500

I copied build.xml from a sample (specifically tutorial-2-opencvcamera), only changing the project name to "opencv". I also created local.properties in that directory with sdk.dir set to my SDK location. After that it worked fine

edit flag offensive delete link more

Comments

Thanks that fixed it for me.

Pete gravatar imagePete ( 2012-08-24 17:26:50 -0500 )edit

Also, I needed to edit build.xml to run the NDK build for tutorial-3 and 4, as described here: http://stackoverflow.com/questions/7432449/android-ndk-build-with-ant-script

noisecapella gravatar imagenoisecapella ( 2012-08-24 21:54:48 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2012-08-16 16:39:13 -0500

Seen: 1,894 times

Last updated: Aug 24 '12