问题描述
我使用javacv我的项目,
在我的项目,我想使用opencv_highui.cvLoadImage功能
I am using javacv for my project,in my project i want to use opencv_highui.cvLoadImage function
我已经加入javacv.jar,javacpp.jar在libs文件夹,所有解压文件等等
在库/ armebi-V7A文件夹
I have added javacv.jar,javacpp.jar in libs folder,and extract all so filesin libs/armebi-v7a folder
但是当我跑我的项目它给我exceptionintialization错误的错误
还有什么其他措施来遵循的OpenCV
but when i run my project it gives me error of exceptionintialization erroris there any other steps to follow for opencv
请给我一些建议。
这里是我code
import static com.googlecode.javacv.cpp.opencv_highgui.*;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
try {
try {
cvLoadImage("mnt/sdcard/make_machine_example1.png");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (Exception e) {
e.printStackTrace();
}
}
[] [1] [1]:
我也有我的附加项目结构,请给我建议
![][1] [1]: http://i.stack.imgur.com/C19pE.pngi have also attached my project structure , Please suggest me
下面是堆栈跟踪
11-21 14:49:47.673: E/AndroidRuntime(2250): java.lang.ExceptionInInitializerError
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.example.demoproject.MainActivity.onCreate(MainActivity.java:23)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.app.Activity.performCreate(Activity.java:4465)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.app.ActivityThread.access$600(ActivityThread.java:127)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.os.Handler.dispatchMessage(Handler.java:99)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.os.Looper.loop(Looper.java:137)
11-21 14:49:47.673: E/AndroidRuntime(2250): at android.app.ActivityThread.main(ActivityThread.java:4448)
11-21 14:49:47.673: E/AndroidRuntime(2250): at java.lang.reflect.Method.invokeNative(Native Method)
11-21 14:49:47.673: E/AndroidRuntime(2250): at java.lang.reflect.Method.invoke(Method.java:511)
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
11-21 14:49:47.673: E/AndroidRuntime(2250): at dalvik.system.NativeStart.main(Native Method)
11-21 14:49:47.673: E/AndroidRuntime(2250): Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1285]: 1418 cannot locate '_ZSt10unexpectedv'...
11-21 14:49:47.673: E/AndroidRuntime(2250): at java.lang.Runtime.loadLibrary(Runtime.java:370)
11-21 14:49:47.673: E/AndroidRuntime(2250): at java.lang.System.loadLibrary(System.java:535)
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:701)
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.googlecode.javacpp.Loader.load(Loader.java:578)
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.googlecode.javacpp.Loader.load(Loader.java:532)
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:79)
11-21 14:49:47.673: E/AndroidRuntime(2250): ... 15 more
11-21 14:49:47.673: E/AndroidRuntime(2250): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load gnustl_static: findLibrary returned null
11-21 14:49:47.673: E/AndroidRuntime(2250): at java.lang.Runtime.loadLibrary(Runtime.java:365)
11-21 14:49:47.673: E/AndroidRuntime(2250): at java.lang.System.loadLibrary(System.java:535)
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:701)
11-21 14:49:47.673: E/AndroidRuntime(2250): at com.googlecode.javacpp.Loader.load(Loader.java:569)
11-21 14:49:47.673: E/AndroidRuntime(2250): ... 17 more
after adding that jars from build path i have following exception
11-21 15:02:05.232: E/AndroidRuntime(17814): FATAL EXCEPTION: main
11-21 15:02:05.232: E/AndroidRuntime(17814): java.lang.ExceptionInInitializerError
11-21 15:02:05.232: E/AndroidRuntime(17814): at com.example.demoproject.MainActivity.onCreate(MainActivity.java:23)
11-21 15:02:05.232: E/AndroidRuntime(17814): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
11-21 15:02:05.232: E/AndroidRuntime(17814): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
11-21 15:02:05.232: E/AndroidRuntime(17814): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-21 15:02:05.232: E/AndroidRuntime(17814): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-21 15:02:05.232: E/AndroidRuntime(17814): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-21 15:02:05.232: E/AndroidRuntime(17814): at android.os.Handler.dispatchMessage(Handler.java:99)
11-21 15:02:05.232: E/AndroidRuntime(17814): at android.os.Looper.loop(Looper.java:123)
11-21 15:02:05.232: E/AndroidRuntime(17814): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-21 15:02:05.232: E/AndroidRuntime(17814): at java.lang.reflect.Method.invokeNative(Native Method)
11-21 15:02:05.232: E/AndroidRuntime(17814): at java.lang.reflect.Method.invoke(Method.java:521)
11-21 15:02:05.232: E/AndroidRuntime(17814): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-21 15:02:05.232: E/AndroidRuntime(17814): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-21 15:02:05.232: E/AndroidRuntime(17814): at dalvik.system.NativeStart.main(Native Method)
11-21 15:02:05.232: E/AndroidRuntime(17814): Caused by: java.lang.NoSuchMethodError: java.util.Arrays.copyOf
11-21 15:02:05.232: E/AndroidRuntime(17814): at com.googlecode.javacpp.Loader.findLibrary(Loader.java:646)
11-21 15:02:05.232: E/AndroidRuntime(17814): at com.googlecode.javacpp.Loader.load(Loader.java:568)
11-21 15:02:05.232: E/AndroidRuntime(17814): at com.googlecode.javacpp.Loader.load(Loader.java:532)
11-21 15:02:05.232: E/AndroidRuntime(17814): at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:79)
11-21 15:02:05.232: E/AndroidRuntime(17814): ... 14 more
你有任何想法?
谢谢
Do you have any idea about it ?Thanks
推荐答案
只要把所有的 *。所以
你的项目里面文件直接库/ armeabi
目录。不要把他们中的任何其他子目录,例如:库/ armeabi / COM /谷歌code /...
等
Just put all the *.so
files DIRECTLY inside your projects libs/armeabi
directory. DO NOT put them inside any other sub-directories such as: libs/armeabi/com/googlecode/...
etc
这篇关于异常初始化错误javacv的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!