Tuesday, 17 September 2013

Build Project using NDK

Please follow the below guidelines:
  1. Consider the $PROJECT as the Project Directory, say SampleApplication as my Project.
  2. Create two Directories inside the Project Directory, namely
    1. jni\
    2. code\
  3. Place the Android.mk inside the jni\ directory.
  4. Place the entire code inside the code\ directory.
  5. Open command prompt and go to the $Project directory, then run %NDK_BUILD%, provided you are in windows and you have created an Environment Variable named NDK_BUILD which will be as follows: eg: D:\Backups\Android-NDK\ndk-build.
  6. Build the code in windows by giving %NDK_BUILD%.

Sample Android.mk File

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE            :=     libvncclient
LOCAL_SRC_FILES            :=     <source file names, current directory will be jni>
LOCAL_C_INCLUDES        :=  $(LOCAL_PATH)/include/
LOCAL_CFLAGS            :=    <MACRO DEFINITIONS>
LOCAL_LDLIBS            :=   
LOCAL_SHARED_LIBRARIES     :=   
include $(BUILD_SHARED_LIBRARY)

TADA.......................

No comments:

Post a Comment