jloyd / javacv

Automatically exported from code.google.com/p/javacv
GNU General Public License v2.0
0 stars 0 forks source link

More UnsatisfiedLinkError problems for Android app. #61

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Follow directions on home page to configure project (add javacpp.jar, 
javacv.jar to libs, extract .so files from android-arm and from 
OpenCV2.2.0-android) use demo code on home page.
2. Compile the eclipse project without problems.
3. Upload and run code on Android device (mine is Desire HD, 2.2)

What is the expected output? What do you see instead?
OpenCv commands are supposed to execute.

What actually happens is that application crashes and does a Force Close.  
Using DDMS, the error given is:

Exception Ljava/lang/UnsatisfiedLinkError; thrown during 
Lcom/googlecode/javacv/cpp/opencv_core;.<clinit>

Exception Ljava/lang/ExceptionInInitializerError; thrown during 
Lcom/googlecode/javacv/cpp/opencv_imgproc;.<clinit>

Exception Ljava/lang/ExceptionInInitializerError; thrown during 
Lcom/googlecode/javacv/cpp/opencv_highgui;.<clinit>

Exception Ljava/lang/ExceptionInInitializerError; thrown during 
Lcom/googlecode/javacv/cpp/opencv_objdetect;.<clinit>

What version of the product are you using? On what operating system?
Latest javacv, opencv2.2.0-android .so files, working on Win7 64bit in Eclipse.

Please provide any additional information below.

I saw that it could be a 32/64bit miss match, so I uninstalled my 64bit jdk and 
installed the 32 bit version instead...that didn't help.  I realise that this 
is probably not a bug, but me doing something wrong, but I've struggled to get 
this to run for a while and would appreciate some help!

Thanks!

Original issue reported on code.google.com by redditaliencode@gmail.com on 22 Apr 2011 at 1:50

GoogleCodeExporter commented 9 years ago
If you install the APK at this URL
http://code.google.com/p/javacv/downloads/detail?name=facepreview-20110407.apk
does it work? It so, can you check that the files in your APK matches the files 
in my APK? Thanks

And in cases when you think it is not an issue with JavaCV, could you instead 
post your questions on the mailing list next time? thank you

Original comment by samuel.a...@gmail.com on 22 Apr 2011 at 3:41

GoogleCodeExporter commented 9 years ago
Example was tested on NexusOne and Galaxy S. I have put example in Eclipse and 
share it on https://github.com/dejanxxx/AndroidJavaCV 
Try it!

Original comment by matej.cr...@gmail.com on 22 Apr 2011 at 11:04

GoogleCodeExporter commented 9 years ago
I see you are using an old version of JavaCV. Please use the latest version.

Original comment by samuel.a...@gmail.com on 22 Apr 2011 at 3:04

GoogleCodeExporter commented 9 years ago
Thanks for your help guys, using matej's example got me on the right track.  
Okay, will use the mailing list from now on!

Thanks again for all the great work!

Original comment by redditaliencode@gmail.com on 22 Apr 2011 at 3:54

GoogleCodeExporter commented 9 years ago
Ah, matej's code was actually working, got confused here. Good, marking as 
done. Thanks matej!

Original comment by samuel.a...@gmail.com on 22 Apr 2011 at 4:26

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hmm, still having problems.

I got matej's code to run fine, but I keep getting more UnsatisfiedLinkErrors 
for opencv code that I've added.

Unable to dlopen(/data/data/edu.feri.smartphone/lib/libjniopencv_calib3d.so): 
Cannot load library: link_image[1995]: failed to link libjniopencv_calib3d.so

Exception Ljava/lang/UnsatisfiedLinkError; thrown during 
Lcom/googlecode/javacv/cpp/opencv_calib3d;.<clinit>

Exception Ljava/lang/ExceptionInInitializerError; thrown during 
Lcom/googlecode/javacv/cpp/opencv_features2d;.<clinit>

Exception Ljava/lang/ExceptionInInitializerError; thrown during 
Lcom/googlecode/javacv/cpp/opencv_features2d$CvSURFParams;.<clinit>

Any ideas?

Original comment by redditaliencode@gmail.com on 23 Apr 2011 at 1:24

GoogleCodeExporter commented 9 years ago
Maybe you have to actually add these files to your package. Can you please read 
the README.txt file? Thank you

Original comment by samuel.a...@gmail.com on 23 Apr 2011 at 1:57

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I've read the readme.txt many times, I still can't figure out why it's not 
working.  I've got the libjniopencv_calib3d.so et al files in the libs/armeabi 
folder...but it's not linking to them for some reason.  I've added the paths to 
the jars and .so's to my $CLASSPATH and $PATH variables, still no joy.

Could it still somehow be a 64bit issue? I wonder if the opencv .so files matej 
uses in his project were compiled by him to be 64 bit?

EDIT: I've also tried adding links to the .so files armeabi in different places 
(e.g Project/Properties/Resource/Linked Resource, and Project/Properties/Java 
Build Path/Source etc), still no luck. 

Original comment by redditaliencode@gmail.com on 23 Apr 2011 at 5:22

GoogleCodeExporter commented 9 years ago
Hi!
If you using example form github than you need to know that we have added only 
som lib-s, otherwise apk is very large. 
For your example:
1. Please download android version zip from javacv
2. Copy missing (or all replace current) .so files in libs/armeabi map in your 
project
3. Refresh project in Eclipse
4. Maybe you need to clean and rebuild project

Original comment by matej.cr...@gmail.com on 23 Apr 2011 at 5:39

GoogleCodeExporter commented 9 years ago
Thanks again for your help matej, appreciate it.

I think I see what I was doing wrong!  I was extracing the .so files from the 
javacv-android-arm.far file, and not the actual Android OpenCV file.  I'm 
pretty sure I did earlier, but something else must have been missing.  Anyway, 
no more link errors...thank you!

Original comment by redditaliencode@gmail.com on 23 Apr 2011 at 1:39

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Hmm. Wasn't sure if I should open a new one with this question, since I'm not 
sure this is a bug, but:

Now I'm getting a java.lang.NoClassDefFoundError: java.util.ArrayDeque when 
making the call:

CvMat pt1  = CvMat.take(1, objectDescriptors.length, CV_32F, 2);

Here's some more info:

Could not find class 'java.util.ArrayDeque', referenced from method 
com.googlecode.javacv.cpp.opencv_core$CvMat.getDeque

unable to resolve check-cast 723 (Ljava/util/ArrayDeque;) in 
Lcom/googlecode/javacv/cpp/opencv_core$CvMat;

Original comment by redditaliencode@gmail.com on 24 Apr 2011 at 12:33

GoogleCodeExporter commented 9 years ago
Android doesn't have that class.. I'm dropping those things anyway in the next 
release of JavaCV for ThreadLocal objects anyway, so don't worry about it.

Original comment by samuel.a...@gmail.com on 24 Apr 2011 at 1:49

GoogleCodeExporter commented 9 years ago
So does that mean I can't call CvMat.take() on Android at all?

The Android developer site does seem to show an ArrayDeque class.
http://developer.android.com/reference/java/util/ArrayDeque.html

Original comment by redditaliencode@gmail.com on 24 Apr 2011 at 2:23

GoogleCodeExporter commented 9 years ago
Update.

It seems that a work-around is to use CvMat.create(...) instead of 
CvMat.take(...)!

Original comment by redditaliencode@gmail.com on 24 Apr 2011 at 5:49

GoogleCodeExporter commented 9 years ago
can you help me guys how to use JavaCV.cvtColor function in android by clicking 
the button and the imageview will convert to grayscale...please help

Original comment by IanBened...@gmail.com on 24 Aug 2012 at 4:10