Advanced Android Development Listing 115 jniAndroidmk

include $(CLEAR_VARS)

LOCAL_MODULE := ndkcookbook LOCAL_SRC_FILES := cookbook.c include $(BUILD_SHARED_LIBRARY)

The next step is to build the native library.With NDK-r4, calling the provided build script ndk-build at the NDK root directory of the project builds the libraries with an associated makefile. For older versions, the command make APP=NAME_OF_APPLICATION is needed. After the libraries are built, a lib/ folder is created containing the native library libndkcookbook.so. In NDK-r4, it also contains two gdb files that help with debugging.

The Android activity that utilizes this library calls the System.loadLibrary() to load the ndkcookbook library. Then, the native function needs to be declared.This is shown in Listing 11.6.The output is shown in Figure 11.2.

Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook


Post a comment