简体   繁体   中英

Android NDK Build error in Cygwin

I am configuring NDK for an android app which makes use of the linux/input.h file in its header - #include . The issue is when I call ndk-build, it gives an error which basically implies that it cannot find linux/input.h. Now, cygwin does not contain the linux directory, which is probably why this error is occuring but the ndk does contain it - android-ndk-r8e\\platforms\\android-14\\arch-x86\\usr\\include\\linux\\input.h - shouldn't ndk-build search here as well? To give some more context, I am trying to compile the EventInjector library described here and others seem to have it working, which means it must be possible somehow.

Please follow these instructions:

  1. in Android.mk

     LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) TARGET_PLATFORM := android-8 LOCAL_MODULE := your_lib LOCAL_SRC_FILES := my_file.c LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog include $(BUILD_SHARED_LIBRARY)</li> 

your_lib will be the name of your library, you may write any name

my_file.c will be your source file name that is present in JNI folder

 Right click on project Choose Properties>Builders Click on New... Select Program, then Ok In main tab: Give your Builder a suitable name, eg. "NDK" For Location, click on Browse file system>select your ndk-build.cmd, eg. C:\\android-ndk-r8-windows\\android-ndk-r8\\ndk-build.cmd (My NDK path) Below there will be Working Directory: Click on: Browse workspace - choose your project, eg. ${workspace_loc:/Test} (My project 'Test') Click on **Refresh Tab** Select **Specific Resources** radio button Click on **Specify Resources..** Select libs folder from your project Now click on **Build Options** Tab Check: After a Clean During manual builds During auto builds Specify working set of relevant resources Click on **Specify Resources...** Select JNI folder of your project Click Apply...Ok 

Now clean it and build...then refresh

You will get your_lib.so in libs>armeabi libs>armeabi>your_lib.so this structure will create automatically ....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM