Posted on 06-05-2015
Filed Under (Technology) by bigbang

In Android jni folder, we will always add some C/C++ header file folders. Basically, there are two ways to do this job.

Option 1:

Add one of the following lines to your Android.mk inside a module of your choice:

LOCAL_C_INCLUDES := /path/to/your/includes # ignore previous includes
                                           # OR
LOCAL_C_INCLUDES += /path/to/your/includes # preserve previous includes

If necessary you could create an environment variable pointing at ‘/path/to/your/includes’ and include it like this:

LOCAL_C_INCLUDES := $(MYLIB_INCLUDES_PATH) # ignore previous includes
                                           # OR
LOCAL_C_INCLUDES += $(MYLIB_INCLUDES_PATH) # preserve previous includes

If you write following code but there is no effect:

LOCAL_C_INCLUDES := ../example/include
LOCAL_C_INCLUDES += ../example/include2

please add $(LOCAL_PATH) to them, which will be:

LOCAL_C_INCLUDES := $(LOCAL_PATH)../example/include
LOCAL_C_INCLUDES += $(LOCAL_PATH)../example/include2

Option 2:

  1. Copy the complete folder with all header-files in it (mylib) into the ‘jni’ folder of your project.
  2. Add the following line to your Android.mk inside a module of your choice:
LOCAL_C_INCLUDES := $(LOCAL_PATH)/mylib

or

LOCAL_C_INCLUDES += $(LOCAL_PATH)/mylib

Depending on whether there are previous includes or not. If the include is the first one, use the first examle which use := as keyword. If has previous includes, use latter which is += as keyword.

© 2015, The Big Bang on Reading Busy. All rights reserved.
On republishing this post you must provide link to the original post.

(0) Comments    (482) Views    Read More   
Post a Comment
Name:
Email:
Website:
Comments: