shaokang/android-event-injector

Compile error on Android-19

Opened this issue · 1 comments

Hi,

I just tried to compile this code under Android-19/Win7 and wanted to share how 
I achieved this. First of all, the usual update in AndroidManifest + 
project.properties to change to Android 19. Then, when trying to running 
ndk-build I would get a whole bunch of errors:

[armeabi] Cygwin         : Generating dependency file converter script
[armeabi] Compile thumb  : EventInjector <= EventInjector.c
In file included from jni/EventInjector.c:55:0:
jni/EventInjector.h:43:9: error: 'INPUT_PROP_POINTER' undeclared here (not in a 
function)
jni/EventInjector.h:44:9: error: 'INPUT_PROP_DIRECT' undeclared here (not in a 
function)
jni/EventInjector.h:45:9: error: 'INPUT_PROP_BUTTONPAD' undeclared here (not in 
a function)
...

I found that these constants aren't defined in include/linux/input.h but rather 
in include/uapi/linux/input.h. I pulled this file from my Ubuntu maschine 
(/usr/src/linux-headersXXX/include/uapi/linux but you can get here from the 
Linux Kernel as well) and put this file into jni/uapi/linux/input.h. A whole 
bunch of stuff is defined twice: in the local /uapi/linux/input.h and in 
NDK_HOME\platforms\android-19\arch-arm\usr\include\linux\input.h. I removed the 
overlapping (see attachement) in my local copy.
Secondly, the line EventInjector.h:82 wouldn't compile. I changed it to:

    LOGD("%s", szBuffer);

This enabled me to compile the whole thing using ndk-build and then install it 
normally via Eclipse on my phone.

Hope this helps anyone.


Original issue reported on code.google.com by rolf.sch...@gmail.com on 16 Jun 2014 at 3:05

Attachments:

I forgot to mention: in EventInjector.h I changed the include to

#include <uapi/linux/input.h>

(Note that you could also put this new input.h into your 
NDK_HOME\platforms\android-19\arch-arm\usr\).

Original comment by rolf.sch...@gmail.com on 16 Jun 2014 at 3:08