UnsatisfiedLinkError with JavaCV

1,935 views
Skip to first unread message

Abhishek Chanda

unread,
Feb 12, 2012, 1:34:19 AM2/12/12
to jav...@googlegroups.com
Hi,

Sorry for the nubie question!
I am trying to run a basic face detection code on Android. Attached the activity with this email. I am getting this exception "UnsatisfiedLinkError: Couldn't load libopencv_java: findLibrary returned null". Here is the full stack trace

02-12 01:13:18.456: E/AndroidRuntime(796): FATAL EXCEPTION: main
02-12 01:13:18.456: E/AndroidRuntime(796): java.lang.UnsatisfiedLinkError: Couldn't load libopencv_java: findLibrary returned null
02-12 01:13:18.456: E/AndroidRuntime(796): at java.lang.Runtime.loadLibrary(Runtime.java:429)
02-12 01:13:18.456: E/AndroidRuntime(796): at java.lang.System.loadLibrary(System.java:554)
02-12 01:13:18.456: E/AndroidRuntime(796): at com.apps.objectdetection.AnalyzeActivity.onCreate(AnalyzeActivity.java:41)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.app.ActivityThread.startActivityNow(ActivityThread.java:1487)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:654)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.widget.TabHost.setCurrentTab(TabHost.java:326)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:132)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:456)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.view.View.performClick(View.java:2485)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.view.View$PerformClick.run(View.java:9080)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.os.Handler.handleCallback(Handler.java:587)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.os.Handler.dispatchMessage(Handler.java:92)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.os.Looper.loop(Looper.java:123)
02-12 01:13:18.456: E/AndroidRuntime(796): at android.app.ActivityThread.main(ActivityThread.java:3683)
02-12 01:13:18.456: E/AndroidRuntime(796): at java.lang.reflect.Method.invokeNative(Native Method)
02-12 01:13:18.456: E/AndroidRuntime(796): at java.lang.reflect.Method.invoke(Method.java:507)
02-12 01:13:18.456: E/AndroidRuntime(796): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-12 01:13:18.456: E/AndroidRuntime(796): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-12 01:13:18.456: E/AndroidRuntime(796): at dalvik.system.NativeStart.main(Native Method)

Attached a screenshot showing all libraries that I have.
I am sure I am missing something very basic here! What might that be?

Thanks



--
Abhishek Chanda
screenshot.png
AnalyzeActivity.java

Samuel Audet

unread,
Feb 12, 2012, 9:27:37 AM2/12/12
to jav...@googlegroups.com
On 2012-02-12 15:34, Abhishek Chanda wrote:
> Attached a screenshot showing all libraries that I have.
> I am sure I am missing something very basic here! What might that be?

You're missing the lib*.so files in the libs directory. Please follow
the instructions in the README.txt file, thank you

Samuel

hoangnn

unread,
Feb 12, 2012, 10:46:47 AM2/12/12
to javacv
i'm sorry for my english.
i have same problem with @Abhishek Chanda.I have downloaded newest
version of library,follow instruction,and i have check lib*.so in libs
directory and in emulator i have check it have exist in /data/data/
[my_app_name]/lib but it cannot load,I didn't know why.please help me.

Samuel Audet

unread,
Feb 12, 2012, 10:52:18 AM2/12/12
to jav...@googlegroups.com
Which lib*.so files?

hoangnn

unread,
Feb 12, 2012, 10:58:47 AM2/12/12
to javacv
sr for my english.
I have try to use this library as Abhishek Chanda on ubuntu 11.10
But i've same problem with him.I'va follow the instruction in the
example and check libs folder,it have lib*.and in /data/data/
[my_app_name]/lib it contain every lib but can not load.I didn't know
why,please help me.
Thank for your support!

On Feb 12, 9:27 pm, Samuel Audet <samuel.au...@gmail.com> wrote:

Nguyễn Ngọc Hoàng

unread,
Feb 12, 2012, 11:20:22 AM2/12/12
to jav...@googlegroups.com
i use all lib*.so in javacv-android-arm.jar,when error i try which all file in OpenCV-2.3.1-android-arm.zip but it still not work. and missing lib is libopencv_core.so.
Sorry for retype.This is first time i reply on this.

2012/2/12 Samuel Audet <samuel...@gmail.com>



--
Nguyễn Ngọc Hoàng K52 Hedspi-việt nhật

Abhishek Chanda

unread,
Feb 12, 2012, 3:10:35 PM2/12/12
to jav...@googlegroups.com
Hi,

Thanks for the reply.
I extracted *.so files from javacv-android-arm.jar and OpenCV-2.3.1-android-arm.zip in the libs directory. I also updated PATH and CLASSPATH to point to that directory. But I got the same error.
Attached a screenshot of the libs directory.

Thanks
--
Abhishek Chanda
error.png

Samuel Audet

unread,
Feb 12, 2012, 11:17:21 PM2/12/12
to jav...@googlegroups.com
The README.txt file does not say to extract the *.so in the "libs"
directory. Please read the instructions again, and follow them, again,
but correctly this time.

And please stop attaching large image files to messages you send to the
mailing list, thank you

Samuel

Samuel Audet

unread,
Feb 12, 2012, 11:18:31 PM2/12/12
to jav...@googlegroups.com
So, which files exactly do you have in /data/data/[my_app_name]/lib ?
Can you provide us with a list?

Nguyễn Ngọc Hoàng

unread,
Feb 12, 2012, 11:47:56 PM2/12/12
to jav...@googlegroups.com
sorry,i do it right but description wrong.
First i create new project
I created libs folder.
in libs folder i create armeabi folder and do as instruction.
Because i have compile android project with ndk and native code so i'm sure i have do it right and, by use emulator i checked every lib*.so file was copped to /data/data/[my_app_name]/lib .[every lib*.so file in libs/armeabi will be copped to lib folder but i cannot load] and permission  of this folder is dwxr-xr--r and same for all sub file with not d [not directory].
any thing wrong? plz help me.
if need i will send my project and screen shot.
Thank for support

2012/2/13 Samuel Audet <samuel...@gmail.com>

Samuel Audet

unread,
Feb 12, 2012, 11:56:53 PM2/12/12
to jav...@googlegroups.com
Please DO NOT send a screenshot. Simply copy/paste the error messages
from your log file, thank you

And please give me a list of all the *.so files you have in those
directories, or I will not be able to help you

On 2012-02-13 13:47, Nguyễn Ngọc Hoàng wrote:
> sorry,i do it right but description wrong.
> First i create new project
> I created libs folder.
> in libs folder i create armeabi folder and do as instruction.
> Because i have compile android project with ndk and native code so i'm
> sure i have do it right and, by use emulator i checked every lib*.so
> file was copped to /data/data/[my_app_name]/lib .[every lib*.so file in
> libs/armeabi will be copped to lib folder but i cannot load] and
> permission of this folder is dwxr-xr--r and same for all sub file with
> not d [not directory].
> any thing wrong? plz help me.
> if need i will send my project and screen shot.
> Thank for support
>
> 2012/2/13 Samuel Audet <samuel...@gmail.com

> <mailto:samuel...@gmail.com>>


>
> So, which files exactly do you have in /data/data/[my_app_name]/lib
> ? Can you provide us with a list?
>
>
> On 2012-02-13 00:58, hoangnn wrote:
>
> sr for my english.
> I have try to use this library as Abhishek Chanda on ubuntu 11.10
> But i've same problem with him.I'va follow the instruction in the
> example and check libs folder,it have lib*.and in /data/data/
> [my_app_name]/lib it contain every lib but can not load.I didn't
> know
> why,please help me.
> Thank for your support!
>
> On Feb 12, 9:27 pm, Samuel Audet<samuel.au...@gmail.com

Nguyễn Ngọc Hoàng

unread,
Feb 13, 2012, 12:36:34 AM2/13/12
to jav...@googlegroups.com
02-13 11:38:49.774: E/AndroidRuntime(330): java.lang.ExceptionInInitializerError
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.example.TestFilterActivity.onCreate(TestFilterActivity.java:30)
02-13 11:38:49.774: E/AndroidRuntime(330):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-13 11:38:49.774: E/AndroidRuntime(330):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-13 11:38:49.774: E/AndroidRuntime(330):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-13 11:38:49.774: E/AndroidRuntime(330):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-13 11:38:49.774: E/AndroidRuntime(330):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-13 11:38:49.774: E/AndroidRuntime(330):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-13 11:38:49.774: E/AndroidRuntime(330):     at android.os.Looper.loop(Looper.java:123)
02-13 11:38:49.774: E/AndroidRuntime(330):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.reflect.Method.invokeNative(Native Method)
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.reflect.Method.invoke(Method.java:521)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-13 11:38:49.774: E/AndroidRuntime(330):     at dalvik.system.NativeStart.main(Native Method)
02-13 11:38:49.774: E/AndroidRuntime(330): Caused by: java.lang.ExceptionInInitializerError
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.Class.classForName(Native Method)
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.Class.forName(Class.java:235)
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.Class.forName(Class.java:182)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.googlecode.javacpp.Loader.load(Loader.java:305)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:91)
02-13 11:38:49.774: E/AndroidRuntime(330):     ... 14 more
02-13 11:38:49.774: E/AndroidRuntime(330): Caused by: java.lang.ExceptionInInitializerError
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.Class.classForName(Native Method)
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.Class.forName(Class.java:235)
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.Class.forName(Class.java:182)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.googlecode.javacpp.Loader.load(Loader.java:305)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.googlecode.javacv.cpp.opencv_imgproc.<clinit>(opencv_imgproc.java:96)
02-13 11:38:49.774: E/AndroidRuntime(330):     ... 19 more
02-13 11:38:49.774: E/AndroidRuntime(330): Caused by: java.lang.UnsatisfiedLinkError: Library jniopencv_core not found
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.Runtime.loadLibrary(Runtime.java:461)
02-13 11:38:49.774: E/AndroidRuntime(330):     at java.lang.System.loadLibrary(System.java:557)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.googlecode.javacpp.Loader.load(Loader.java:358)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.googlecode.javacpp.Loader.load(Loader.java:285)
02-13 11:38:49.774: E/AndroidRuntime(330):     at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:127)
02-13 11:38:49.774: E/AndroidRuntime(330):     ... 24 more
02-13 11:43:49.809: I/Process(330): Sending signal. PID: 330 SIG: 9

<<-------------------------------End Log--------------------------------->

libjniARToolKitPlus.so
libjniavcodec.so
libjniavdevice.so
libjniavformat.so
libjniavutil.so
libjnicvkernels.so
libjniopencv_calib3d.so
libjniopencv_contrib.so
libjniopencv_core.so
libjniopencv_features2d.so
libjniopencv_flann.so
libjniopencv_highgui.so
libjniopencv_imgproc.so
libjniopencv_legacy.so
libjniopencv_ml.so
libjniopencv_objdetect.so
libjniopencv_video.so
libjnipostproc.so
libjniswscale.so


This is list .so file in lib folder.
Thank you.

2012/2/13 Samuel Audet <samuel...@gmail.com>

Samuel Audet

unread,
Feb 13, 2012, 12:57:04 AM2/13/12
to jav...@googlegroups.com
On 2012-02-13 14:36, Nguyễn Ngọc Hoàng wrote:
> libjniARToolKitPlus.so
> libjniavcodec.so
> libjniavdevice.so
> libjniavformat.so
> libjniavutil.so
> libjnicvkernels.so
> libjniopencv_calib3d.so
> libjniopencv_contrib.so
> libjniopencv_core.so
> libjniopencv_features2d.so
> libjniopencv_flann.so
> libjniopencv_highgui.so
> libjniopencv_imgproc.so
> libjniopencv_legacy.so
> libjniopencv_ml.so
> libjniopencv_objdetect.so
> libjniopencv_video.so
> libjnipostproc.so
> libjniswscale.so
>
>
> This is list .so file in lib folder.
> Thank you.

libopencv_core.so, etc. are missing from that list. Please extract those
as well, as per the instructions in the README.txt file

Samuel

Nguyễn Ngọc Hoàng

unread,
Feb 13, 2012, 1:42:52 AM2/13/12
to jav...@googlegroups.com
ok,it work.thank you for support.
One more thing,i am working in a project that make some image filter on android,but i'm not have many experience in native code and image process so time of processing is too long,so please don't mind if i ask some stupid question in the future.
many thanks.

2012/2/13 Samuel Audet <samuel...@gmail.com>

syamantak namde

unread,
Mar 13, 2013, 5:02:20 AM3/13/13
to jav...@googlegroups.com
libs/armeabi contains following files---->>>>>>
libjniARToolKitPlus.so
libjniavcodec.so
libjniavdevice.so
libjniavfilter.so
libjniavformat.so
libjniavutil.so
libjnicvkernels.so
libjniopencv_calib3d.so
libjniopencv_contrib.so
libjniopencv_core.so
libjniopencv_features2d.so
libjniopencv_flann.so
libjniopencv_highgui.so
libjniopencv_imgproc.so
libjniopencv_legacy.so
libjniopencv_ml.so
libjniopencv_nonfree.so
libjniopencv_objdetect.so
libjniopencv_photo.so
libjniopencv_stitching.so
libjniopencv_video.so
libjniopencv_videostab.so
libjnipostproc.so
libjniswresample.so
libjniswscale.so
libopencv_androidcamera.a
libopencv_calib3d.a
libopencv_calib3d.so
libopencv_contrib.a
libopencv_contrib.so
libopencv_core.a
libopencv_core.so
libopencv_features2d.a
libopencv_features2d.so
libopencv_flann.a
libopencv_flann.so
libopencv_highgui.a
libopencv_highgui.so
libopencv_imgproc.a
libopencv_imgproc.so
libopencv_info.so
libopencv_java.so
libopencv_legacy.a
libopencv_legacy.so
libopencv_ml.a
libopencv_ml.so
libopencv_nonfree.so
libopencv_objdetect.a
libopencv_objdetect.so
libopencv_photo.a
libopencv_photo.so
libopencv_stitching.a
libopencv_stitching.so
libopencv_ts.a
libopencv_ts.so
libopencv_video.a
libopencv_video.so
libopencv_videostab.a
libopencv_videostab.so
libtbb.so

+ javacv 0.4 ---> javacv.jar and javacpp.jar in the libs folder with path included in the build path.... with having no compiler error

i get link unsatisfactionlink error saying ddnt find opencv_core lib  on android 2.3.6 version

Is the combination okay ? 
what is wrong do you think?
Thank you.
Syamantak

Samuel Audet

unread,
Mar 16, 2013, 7:23:52 AM3/16/13
to jav...@googlegroups.com
On 03/13/2013 06:02 PM, syamantak namde wrote:
> i get link unsatisfactionlink error saying ddnt find opencv_core lib on
> android 2.3.6 version
>
> Is the combination okay ?
> what is wrong do you think?

Looks alright, but try to reinstall the Android SDK, recreate your
project files, remove any traces of your application on your device,
etc. and try again. That usually fixes problems with Android: It's not
very reliable.

Let me know if that doesn't do the trick though, thanks

Samuel
Reply all
Reply to author
Forward
0 new messages