If you have multiple libs to build then make Android.mk file for each library and call those .mk files in the root Android.mk file. On how to write Android.mk file refer Android NDK docs folder
1. xxxxx/jni/lib1/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE :=lib1
LOCAL_SRC_FILES :=aaa.c \
bb.c \
include $(BUILD_STATIC_LIBRARY)
2. xxxxx/jni/lib2/Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE :=lib2
LOCAL_SRC_FILES :=asdf.c \
qwert.c \
include $(BUILD_STATIC_LIBRARY)
3. /jni/Android.mk
MY_JNI_FOLDER := $(call my-dir)
include $(MY_JNI_FOLDER)/lib1/Android.mk
include $(MY_JNI_FOLDER)/lib2/Android.mk
Now create another file Application.mk
APP_MODULES := lib1 lib2 // Note that each module specified here will perform a force build, which yields lib1.a and lib2.a
APP_OPTIM := release
APP_ABI := armeabi armeabi-v7a
Now, type build using ndk-build script
xxxxx@NHPC /cygdrive/c/android-ndk-r4b/samples/hello-jni/jni
$ ../../ndk-build
[...] Android Dev ← Compile Static Library only using NDK [...]
ReplyDelete