Cannot locate symbol "av_malloc_array" referenced by "libswresample.so"
la-matthew-yang opened this issue · 9 comments
I have been using version 0.24 for a while now and, for most devices, everything is working great!
However, on some devices, I am getting the following error upon app launch. i.e. app crashes on launch.
Environment:
LibGdx Oboe 0.24, LibGdx 1.9.11
Error Log:
57--------- beginning of crash
5809-14 15:48:17.929 13698 13698 E AndroidRuntime: FATAL EXCEPTION: main
5909-14 15:48:17.929 13698 13698 E AndroidRuntime: Process: com.test.android, PID: 13698
6009-14 15:48:17.929 13698 13698 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "av_malloc_array" referenced by "libswresample.so"...
6109-14 15:48:17.929 13698 13698 E AndroidRuntime: at java.lang.Runtime.loadLibrary(Runtime.java:371)
6209-14 15:48:17.929 13698 13698 E AndroidRuntime: at java.lang.System.loadLibrary(System.java:988)
6309-14 15:48:17.929 13698 13698 E AndroidRuntime: at barsoosayque.libgdxoboe.OboeAudio.<init>(OboeAudio.kt:6)
com.test.android.CustomAndroidActivity.onCreate(CustomAndroidActivity.java:1)
6509-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5990)
6609-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
6709-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2312)
6809-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2421)
6909-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:151)
7009-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1333)
7109-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
7209-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.os.Looper.loop(Looper.java:135)
7309-14 15:48:17.929 13698 13698 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5288)
7409-14 15:48:17.929 13698 13698 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
7509-14 15:48:17.929 13698 13698 E AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)
7609-14 15:48:17.929 13698 13698 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1107)
7709-14 15:48:17.929 13698 13698 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:898)
11109-14 15:48:18.247 13751 13751 W linker : libgdx.so: unused DT entry: type 0x6ffffffe arg 0x30d8
11209-14 15:48:18.248 13751 13751 W linker : libgdx.so: unused DT entry: type 0x6fffffff arg 0x2
11309-14 15:48:18.253 13751 13770 W GAv4 : AnalyticsService not registered in the app manifest. Hits might not be delivered reliably. See http://goo.gl/8Rd3yj for instructions.
11409-14 15:48:18.295 13751 13751 W linker : liblibgdx-oboe.so: unused DT entry: type 0x6ffffef5 arg 0x223b0
11509-14 15:48:18.296 13751 13751 W linker : liblibgdx-oboe.so: unused DT entry: type 0x6ffffffe arg 0x2af54
11609-14 15:48:18.297 13751 13751 W linker : liblibgdx-oboe.so: unused DT entry: type 0x6fffffff arg 0x7
11709-14 15:48:18.297 13751 13751 W linker : libswresample.so: unused DT entry: type 0x6ffffef5 arg 0xafc
11809-14 15:48:18.297 13751 13751 W linker : libswresample.so: unused DT entry: type 0x6ffffffe arg 0xed4
11909-14 15:48:18.297 13751 13751 W linker : libswresample.so: unused DT entry: type 0x6fffffff arg 0x3
12009-14 15:48:18.302 13751 13751 E art : dlopen("/data/app/com.test.android-1/lib/arm/liblibgdx-oboe.so", RTLD_LAZY) failed: dlopen failed: cannot locate symbol "av_malloc_array" referenced by "libswresample.so"...
12109-14 15:48:18.302 13751 13751 D AndroidRuntime: Shutting down VM
Is there any correlation between a processor architecture and the crash ?
Some are armeabi-v7a; some are arm64-v8a
Hmm. Are there any working armeabi-v7a / arm64-v8a devices ? Otherwise it might be a false positive link time optimization.. However, I think my own test device is arm64-v8a, so that is indeed confusing.
Also, would be great to know Android version of the devices on which the crash happens, but I doubt that it will be the case 😔
Sorry about the delay.
After some further testing, I found that this is Android API related. Most of the crashes are on API 17, 19 and 22.
I think this is related to the issue of native library loading. Related discussion: https://stackoverflow.com/questions/28806373/android-4-2-ndk-library-loading-crash-load-librarylinker-cpp750-soinfo-l
I think I fixed the issue by loading the so files explicitly like the following in AndroidApplication.java:
:)
SharedLibraryLoader libraryLoader = new SharedLibraryLoader();
libraryLoader.load("avutil");
libraryLoader.load("swresample");
libraryLoader.load("avcodec");
libraryLoader.load("avformat");
Uhh, there is indeed a problem with dynamic linking in API 19+ (link). It is nearly impossible to link ffmpeg libraries statically, so I'll test your workaround, and if it works, I'll use it. Would be super neat if you'd PR it, otherwise I'll push the code after a while.
Even with the static loading, some devices are still reporting the same error. For some other devices, the issue is fixed with the workaround.
I've noticed that the issues are only happening on devices with API level below 23. For 23+ devices, the issue is not found.
I end up using libgdx-oboe for api 23+ and default MediaPlayer based libgdx audio for devices with api version lower than 23.
I honestly would like to help you with this, but I don't have any device that would reproduce the issue. I'll research android dynamic linking once again, and hopefully will be able to blind fix that. Can't make any promises, though.
Seems to be related to #17 if I'm not mistaken