I am trying to build a native app to communicate with a device over hidraw.
While trying to build app through ndk-build, I get following error:
jni/daemon.c:15:26: fatal error: linux/hidraw.h: No such file or directory
make: *** [obj/local/armeabi-v7a/objs/hidrawdaemon/daemon.o] Error 1
arch-arm arch-arm64 arch-mips arch-mips64 arch-x86 arch-x86_64
gps@gps-HP-ProBook-4540s:~/Android/android-ndk-r10e/platforms/android-21$ find . -name hidraw*
This seems like you're targeting an older version of android than 21 - check what you've set as
jni/Application.mk, or what is set in
The reason why it's failing only on 32 bit platforms, is that for the 64 bit platforms,
android-21 is the first version where they're supported at all, so if you target an older version, the 64 bit parts will still be built against
android-21 headers and libs. (Similarly, x86 and mips were added in
So in this case, since
linux/hidraw.h is available only since
android-21, make sure you set this as your minimum platform version.