使用x264重建opencv和ffmpeg会导致java.lang.UnsatisfiedLinkError

时间:2013-04-30 08:16:56

标签: android opencv ffmpeg javacv x264

我已经按照javacv的cppjars zip文件中包含的自述文件,我能够成功构建库但是当我使用新的.so文件运行我的应用程序时,我得到了一个java.lang.UnsatisfiedLinkError但是所有.so文件存在于armeabi文件夹中。 触发此异常的代码行如下所示

yuvIplimage = IplImage.create(imageWidth, imageHeight, IPL_DEPTH_8U, 2);

,例外是这个

04-29 15:40:46.610: E/AndroidRuntime(23057): FATAL EXCEPTION: main
04-29 15:40:46.610: E/AndroidRuntime(23057): java.lang.ExceptionInInitializerError
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.sample.Stream.initRecorder(Stream.java:84)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.sample.Stream.onCreate(Stream.java:77)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.app.Activity.performCreate(Activity.java:4469)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.os.Looper.loop(Looper.java:137)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at android.app.ActivityThread.main(ActivityThread.java:4507)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at java.lang.reflect.Method.invokeNative(Native Method)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at java.lang.reflect.Method.invoke(Method.java:511)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:978)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at dalvik.system.NativeStart.main(Native Method)
04-29 15:40:46.610: E/AndroidRuntime(23057): Caused by: java.lang.ExceptionInInitializerError
04-29 15:40:46.610: E/AndroidRuntime(23057):    at java.lang.Class.classForName(Native Method)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at java.lang.Class.forName(Class.java:217)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.googlecode.javacpp.Loader.load(Loader.java:338)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.googlecode.javacpp.Loader.load(Loader.java:319)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.googlecode.javacv.cpp.opencv_core$CvArr.<clinit>(opencv_core.java:163)
04-29 15:40:46.610: E/AndroidRuntime(23057):    ... 16 more
04-29 15:40:46.610: E/AndroidRuntime(23057): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1965]:   108 could not load needed library 'libopencv_core.so' for 'libjniopencv_core.so' (find_library[1200]:   108 'libopencv_core.so' failed to load previously)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at java.lang.Runtime.loadLibrary(Runtime.java:370)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at java.lang.System.loadLibrary(System.java:535)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:448)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.googlecode.javacpp.Loader.load(Loader.java:372)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.googlecode.javacpp.Loader.load(Loader.java:319)
04-29 15:40:46.610: E/AndroidRuntime(23057):    at com.googlecode.javacv.cpp.opencv_core.<clinit>(opencv_core.java:136)
04-29 15:40:46.610: E/AndroidRuntime(23057):    ... 21 more

我已经满足了所有要求,即java SE 6,OpenCV 2.4.5,FFmpeg 1.2,Android NDK r8e。操作系统是Ubuntu 11.10。

我不认为代码是问题,因为当我使用来自javacv的捆绑库时它很有效,但是当我重建libs以包含x264时遇到问题。

我做错了什么?我已经尝试过NDK的64位和32位版本,但同样的问题仍然存在。

0 个答案:

没有答案