Hi, everybody:
I have tried to use this library in developing Android apps. When installing I have encountered many problems such as:
聽
java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil
But I read the following articles:
https://github.com/bytedeco/javacpp-presets/wiki/The-UnsatisfiedLinkError-X-File-(a-real-experience)
And I successfully solved the problem and my programs are working well by following devices:
However, my client return a crash problem on his Letv X900 (Android 5.0.2) device.
The crash log recorded as follows:
java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "av_fast_mallocz" referenced by "libjniavutil.so"...
at java.lang.Runtime.load(Runtime.java:331)
at java.lang.System.load(System.java:982)
at com.getkeepsafe.relinker.SystemLibraryLoader.loadPath(SystemLibraryLoader.java:29)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibraryInternal(ReLinkerInstance.java:200)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(ReLinkerInstance.java:140)
at com.getkeepsafe.relinker.ReLinkerInstance.loadLibrary(ReLinkerInstance.java:96)
at com.xxxxxx.xxx.application.onCreate(application.java:54)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1011)
In my cognition, the problem comes from the jniavutil.so files, but so far works fine on my devices, only Letv X900 (Android 5.0.2) have this problem.
My code is following:
public void onCreate() {
//init
ReLinker.log(logger).recursively().loadLibrary(mContext, "mpg123");
ReLinker.log(logger).recursively().loadLibrary(mContext, "avutil");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniavutil");//crash in here
ReLinker.log(logger).recursively().loadLibrary(mContext, "avcodec");
ReLinker.log(logger).recursively().loadLibrary(mContext, "avfilter");
ReLinker.log(logger).recursively().loadLibrary(mContext, "advice");
ReLinker.log(logger).recursively().loadLibrary(mContext, "swscale");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniswscalke")
ReLinker.log(logger).recursively().loadLibrary(mContext, "swresample");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniswresample");
ReLinker.log(logger).recursively().loadLibrary(mContext, "postproc");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jnipostproc");
ReLinker.log(logger).recursively().loadLibrary(mContext, "avformat");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniavcodec");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniavdevice");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniavfilter");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniavformat");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jnicvkernels");
ReLinker.log(logger).recursively().loadLibrary(mContext, "opencv_core");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniopencv_imgcodecs");
ReLinker.log(logger).recursively().loadLibrary(mContext, "opencv_imgcodecs");
ReLinker.log(logger).recursively().loadLibrary(mContext, "jniopencv_imgproc");
ReLinker.log(logger).recursively().loadLibrary(mContext, "opencv_imgproc");
//do init
}
Does anyone can give me some suggestions? thanks
Please try with the latest version of JavaCPP (1.2.2) and of the JavaCPP Presets (1.2). After upgrading, please let me know if you are still encountering that issue.
@Larry-XtremeApp @saudet
I encountered this problem with javacpp 1.2.4 and javacpp presets 1.2, javacv 1.2, int Meizu note3.
Help
@Larry-XtremeApp
I fixed it by moving relinker function into main ui thread's onCreate.
I have test huawei p9, huawei mate8, huawei mate7(5.0), letv 2 pro, xiaomi note, Meizu note 3(5.1), all these phones works perfect.
Hope this works for you.
Add: (2016/11/25)
You should clean your project when updating the native library, if you use AS! Remeber!
Most helpful comment
@Larry-XtremeApp
I fixed it by moving relinker function into main ui thread's onCreate.
I have test huawei p9, huawei mate8, huawei mate7(5.0), letv 2 pro, xiaomi note, Meizu note 3(5.1), all these phones works perfect.
Hope this works for you.
Add: (2016/11/25)
You should clean your project when updating the native library, if you use AS! Remeber!