Javacpp-presets: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "av_fast_mallocz" referenced by "libjniavutil.so"

Created on 1 Jul 2016  路  3Comments  路  Source: bytedeco/javacpp-presets

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:

  • Nexus 5X (Android 6.0.1)
  • SAMSUNG GALAXY Note II (Android 4.4.2)
  • SAMSUNG Galaxy grand prime(Android 5.0.2)
  • Asus phone pad (Android 5.0.1)
  • Xiaomi MI2S (Android 5.0.2)

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

question

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!

All 3 comments

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!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

archenroot picture archenroot  路  23Comments

blueberry picture blueberry  路  26Comments

thunterdb picture thunterdb  路  37Comments

oneengineer picture oneengineer  路  34Comments

eix128 picture eix128  路  23Comments