且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Android NDK:获取 java.lang.UnsatisfiedLinkError:dlopen 失败:找不到符号“信号"由“libffmpeg.so"引用;

更新时间:2021-09-16 05:29:59

signal 在平台 android-21 之前是内联函数,现在不再是内联函数了.

signal was an inline function until platform android-21, now it's not inline anymore.

当您使用 ndk r10 时,默认使用 android-21,但它与运行旧 Android 版本的设备不完全兼容.在您的情况下,您的设备上找不到信号(但它可以在 Lollipop 上正常运行).

When you use the ndk r10, android-21 is used by default but it's not fully retro-compatible with devices running former Android versions. In your case, signal can't be found on your device (but it would run properly on Lollipop).

在使用 NDK 时,您应该使用与您的 android:minSdkVersion 对应的平台(APP_PLATFORM:=android-XX).

When using the NDK, you should use the platform (APP_PLATFORM:=android-XX) that corresponds to your android:minSdkVersion.

所以这里你可以在Application.mk Makefile中设置APP_PLATFORM:=android-15,你的lib会使用signal的内联版本,所以看起来不会为它在运行时的符号.

So here you can set APP_PLATFORM:=android-15 inside Application.mk Makefile, and your lib will use the inline version of signal, so it will not look for its symbol at runtime.