This happens if you build against the android-21
platform headers. Set APP_PLATFORM
in jni/Application.mk
to an older version, to build using the old headers, to make sure you only link to functions available earlier.
(Before android-21
, the C library features and headers didn’t really change significantly, so for the normal C library functions, it doesn’t matter if you build targeting android-3
or android-20
.)
This has been reported and is intentional behavior, see e.g. https://code.google.com/p/android/issues/detail?id=73725.
If you don’t need to use new features from android-21
, just build using older headers. (It doesn’t matter that you’re targeting an older platform version if you want to try to build for e.g. arm64-v8a
or x86_64
that didn’t exist before; ndk-build
would build the 32 bit parts using the older target, and the 64 bit ones using the oldest target that supports them.)
In case you want to try to use new features from the android-21
platform conditionally if running on such a platform, you probably need to use dlopen
and dlsym
to load it conditionally anyway, so then you need to duplicate the other definitions from the new headers as well, to allow you to build using the older platform headers.