Reputation: 456
I'm using FrameGrabber to load a video from sdcard and perform some image processing operation. I followed the tutorial at JavaCV site to load javacc and ffmpeg. Currently, to run the application, I'm using my tablet (Asus TF 101G with Android version 4.0.3) connected to my pc and it works fine. But if I try to run the same application in another device (e.g. Nexus with Android 4.1.2) I get these errors:
02-01 16:51:54.687: E/AndroidRuntime(2839): FATAL EXCEPTION: main
02-01 16:51:54.687: E/AndroidRuntime(2839): java.lang.ExceptionInInitializerError
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.googlecode.javacv.FFmpegFrameGrabber.<init>(FFmpegFrameGrabber.java:104)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.example.com.uniud.avires.MainActivity.onCreate(MainActivity.java:92)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.app.Activity.performCreate(Activity.java:5008)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.app.ActivityThread.access$600(ActivityThread.java:130)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.os.Handler.dispatchMessage(Handler.java:99)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.os.Looper.loop(Looper.java:137)
02-01 16:51:54.687: E/AndroidRuntime(2839): at android.app.ActivityThread.main(ActivityThread.java:4745)
02-01 16:51:54.687: E/AndroidRuntime(2839): at java.lang.reflect.Method.invokeNative(Native Method)
02-01 16:51:54.687: E/AndroidRuntime(2839): at java.lang.reflect.Method.invoke(Method.java:511)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
02-01 16:51:54.687: E/AndroidRuntime(2839): at dalvik.system.NativeStart.main(Native Method)
02-01 16:51:54.687: E/AndroidRuntime(2839): Caused by: java.lang.ExceptionInInitializerError
02-01 16:51:54.687: E/AndroidRuntime(2839): at java.lang.Class.classForName(Native Method)
02-01 16:51:54.687: E/AndroidRuntime(2839): at java.lang.Class.forName(Class.java:217)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.googlecode.javacpp.Loader.load(Loader.java:338)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.googlecode.javacv.cpp.avcodec.<clinit>(avcodec.java:86)
02-01 16:51:54.687: E/AndroidRuntime(2839): ... 16 more
02-01 16:51:54.687: E/AndroidRuntime(2839): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 26325 could not load needed library 'libavutil.so' for 'libjniavutil.so' (load_library[1093]: Library 'libavutil.so' not found)
02-01 16:51:54.687: E/AndroidRuntime(2839): at java.lang.Runtime.load(Runtime.java:340)
02-01 16:51:54.687: E/AndroidRuntime(2839): at java.lang.System.load(System.java:521)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:422)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.googlecode.javacpp.Loader.load(Loader.java:372)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.googlecode.javacpp.Loader.load(Loader.java:319)
02-01 16:51:54.687: E/AndroidRuntime(2839): at com.googlecode.javacv.cpp.avutil.<clinit>(avutil.java:75)
02-01 16:51:54.687: E/AndroidRuntime(2839): ... 20 more
Any suggestion please?
I want to attach also my Android.mk file
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_LIB_TYPE:=STATIC
include C:/Users/Marco/Desktop/new_ADT/adt-bundle-windows-x86_64/OpenCV-2.4.3.2-android-sdk/sdk/native/jni/OpenCV.mk
OPENCV_INSTALL_MODULES:=on
#OPENCV_CAMERA_MODULES:=on
LOCAL_MODULE := udmodule
LOCAL_SRC_FILES := udjni.cpp
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
and my Apllication.mk file
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a
#APP_ABI := all
APP_PLATFORM := android-8
Any suggestion? Thanks
Also I tried to change the application.mk file in this way but with no results:
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi
LOCAL_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -mfpu=neon
LOCAL_LDLIBS += -Wl,--fix-cortex-a8
APP_PLATFORM := android-8
Upvotes: 2
Views: 1605
Reputation: 7976
Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: link_image[1891]: 26325 could not load needed library 'libavutil.so' for 'libjniavutil.so' (load_library[1093]: Library 'libavutil.so' not found)
It looks like you call wrong name of file?
Library 'libavutil.so' not found
Should use following code to call file *.so :
static {
System.loadLibrary("libavutil");
}
Upvotes: 0
Reputation: 1750
Cross referencing on www.phonearena.com I'm guessing your tablet uses a NVIDIA Tegra 2 processor, but the Nexus uses a Tegra 3 processor.
I'm assuming your copying the .so files in your lib directory. You might what to take a look at OpenCV4Android here - its packaged as an apk file that can be installed, so you don't have to worry about the .so file being compiled for your platform.
NVIDIA also has instructions for running OpenCV specifically on Tegra processors here.
Hope that helps.
Upvotes: 1