047android初级篇NDK原生程序执行报错

编译出来的程序执行报错:

CANNOT LINK EXECUTABLE: cannot locate symbol "signal" referenced by

解决办法

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

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).

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

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.

即在Application.mk中增加如下设置

APP_PLATFORM := android-16

你可能感兴趣的:(047android初级篇NDK原生程序执行报错)