Ask Your Question
0

Nightmare with Android and OpenCV 2.4.6

asked 2013-08-25 00:48:34 -0600

Scheidecker gravatar image

updated 2013-08-26 02:02:17 -0600

Hello all,

I am trying to write an OpenCV app with my android. I have tried 2 Asus Tablets (TF300 and TF700T) and also a Samsung S4 phone.

In all I have the following error log on Eclipse:

*[2013-08-24 23:20:26 - OpenCV Library - 2.4.6] Could not find OpenCV Library - 2.4.6.apk!*

The rest of the log.

[2013-08-24 23:20:10 - TabletOCR] Android Launch! [2013-08-24 23:20:10 - TabletOCR] adb is running normally. [2013-08-24 23:20:10 - TabletOCR] Performing com.nando.android.MainActivity activity launch [2013-08-24 23:20:22 - TabletOCR] Uploading TabletOCR.apk onto device '5e246c8f' [2013-08-24 23:20:23 - TabletOCR] Installing TabletOCR.apk... [2013-08-24 23:20:26 - TabletOCR] Success! *[2013-08-24 23:20:26 - OpenCV Library - 2.4.6] Could not find OpenCV Library - 2.4.6.apk!* [2013-08-24 23:20:26 - TabletOCR] Starting activity com.nando.android.MainActivity on device 5e246c8f [2013-08-24 23:20:27 - TabletOCR] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.perceptivecore.android/.MainActivity } [2013-08-24 23:27:13 - TabletOCR] ------------------------------

basically, everytime I call an activity that has an org.opencv dependency it crashes.

I have OpenCV Library 2.4.6 as a project on the same workspace. I have added it as a dependecy project to mine after all online I've found has failed. I have the OpenCV Manager installed on the devices.

On the logcat I have:

VFY: unable to find class referenced in signature (Lorg/opencv/core/Mat;)

VFY: unable to resolve const-class 690 (Lcom/nando/android/gui/activities/CameraActivity;) in Lcom/nando/android/MainActivity;

Trying to set that under Project properties/Android/Library and add the reference makes so that the project does not compile under Eclipse and does not launch.

I have tried the tips on the following without success: http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_dev_intro.html http://answers.opencv.org/question/1990/best-opencv-build-for-androidtegra3/ http://stackoverflow.com/questions/17574313/unable-to-display-controls-in-android-project-activity-using-opencv http://stackoverflow.com/questions/18241545/android-logcat-error-message-file-driverlist-txt-not-found http://forums.ouya.tv/discussion/1916/com-nvidia-nvcplsvc-files-driverlist-txt-not-found http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html#o4a-sdk

I would appreciate any help. The fact is: the app cannot find any OpenCV library when I start an activity that depend on them. The debugger stops (class not found) when I try to create an object with that class. If I try to display an activity that does not have OpenCV then it works great!

Any help is appreciated.

Thanks!

edit retag flag offensive close merge delete

Comments

2

Do you also load the libraries? You have to do that in one of your app lifecycle functions, best is onResume. http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_OCV_on_Android.html#dev-with-ocv-on-android

Moster gravatar imageMoster ( 2013-08-25 10:53:34 -0600 )edit

What do you mean load the libraries? The JINI part? I have copied the architecture C++ libs to the folder but I have not created the android.mk nor the opencv.mk. I am not sure where to place them on the project directory tree.

Scheidecker gravatar imageScheidecker ( 2013-08-25 11:29:30 -0600 )edit

Everything is explained in the link I posted. Also, the examples in the android opencv package show how it works.

Moster gravatar imageMoster ( 2013-08-25 11:33:18 -0600 )edit

Moster, Thanks for that. I have seen the JNI folder on the Face Detector sample. The issue that I am having is that:

If I go to Project->Android->Library and add the OpenCVLibrary2.4.6 that is on the same workspace, all my R classes that are generated error out as it cannot see the GEN folder anymore and errors out on my layouts xml as well.

So what I did before was not add the Android->Library reference but to a Project->Java Build Path->Project and add the OpenCV Library - 2.4.6 as a required project on the build path. That removes the IDE and compiler erros and the project can be deployed to the tablet but it then gives me the same errors as before.

On my Application.mk aand Android.mk I have see the stuff as per instructions.

That is the reason why ...(more)

Scheidecker gravatar imageScheidecker ( 2013-08-25 23:15:37 -0600 )edit

Interesting, if I create another Android App from the scratch on the same workspace and use the instructions., then under the "gen" folder I also have org.opencv.R class while on my original project I do not have that and if I add the android library on project.properties file like my test app as in android.library.reference.1=../OpenCV-2.4.6-android-sdk/skd/java then it start giving me all types of errors unlike the new test project.

Scheidecker gravatar imageScheidecker ( 2013-08-26 00:14:42 -0600 )edit

I' ve built my initial project with Maven. I wonder if that is the issue.

Scheidecker gravatar imageScheidecker ( 2013-08-26 00:24:36 -0600 )edit

Small remark. We suggest not to use hashtags in the tags of your topic. They generate a lot of double tags, rendering the search and filter options useless. Keep this in mind at your next post, adjusted it for you now.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-26 02:02:51 -0600 )edit

@Scheidecker Do you try to run any of OpenCV's examples? Are they work?

Daniil Osokin gravatar imageDaniil Osokin ( 2013-08-26 03:55:43 -0600 )edit

On your real project, do you have a red cross or green tick in front of the openv libraries in Properties -> Android -> Library?

Moster gravatar imageMoster ( 2013-08-26 04:02:44 -0600 )edit

Moster, it shows a GREEN tick in front but them all the classes issues errors as the R (cannot be found) from the MainActivity as well as the GEN folder does not display the org.opencv generated files. Running the sample projects and doing my own without Maven seems to work. I will test it tonight without Maven.

Scheidecker gravatar imageScheidecker ( 2013-08-26 14:24:48 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-08-29 02:13:00 -0600

Scheidecker gravatar image

Got it worker Moster! It just does not like Maven is all.

edit flag offensive delete link more

Comments

2

just tick your answer as solved.

berak gravatar imageberak ( 2013-08-29 02:34:03 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-08-25 00:48:34 -0600

Seen: 3,243 times

Last updated: Aug 29 '13