我正在使用 FrameGrabber 从 sdcard 加载视频并执行一些图像处理操作。我按照JavaCV 站点上的教程来加载 javacc 和 ffmpeg。目前,要运行该应用程序,我正在使用连接到我的电脑的平板电脑(Asus TF 101G 和 Android 版本 4.0.3),它工作正常。但是,如果我尝试在另一台设备上运行相同的应用程序(例如,带有 Android 4.1.2 的 Nexus),我会收到以下错误:
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
请问有什么建议吗?
我还想附上我的Android.mk文件
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)
和我的Apllication.mk文件
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_ABI := armeabi armeabi-v7a
#APP_ABI := all
APP_PLATFORM := android-8
有什么建议吗?谢谢
我也尝试以这种方式更改 application.mk 文件但没有结果:
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