Prebuilding different kind of static library in Android NDK

119 views Asked by At

Is there any way that we can build different kind of static libraries (.a extension files) at once, that we created through our NDK ? I think you'll understand better when i shared the code.

Android.mk ->

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := libzlib
LOCAL_SRC_FILES := libzlib.a

include $(PREBUILT_STATIC_LIBRARY)


include $(CLEAR_VARS)

LOCAL_MODULE := libpng
LOCAL_SRC_FILES := libpng.a

include $(PREBUILT_STATIC_LIBRARY)

include $(CLEAR_VARS)

LOCAL_MODULE := callNDK
LOCAL_SRC_FILES := callNDK.c
LOCAL_STATIC_LIBRARIES := libpng libzlib

include $(BUILD_SHARED_LIBRARY)

The static libraries that I include, I copied from the /obj folder that I created with the BUILD_STATIC_LIBRARY. How can I prebuilt them all at once and include them ? Sorry for the bad English and thanks in advance !

1

There are 1 answers

0
Erturr On BEST ANSWER

I was able to find the answer with the variable, TARGET_ARCH_ABI. Adding LOCAL_SRC_FILES := ..\obj\local\$(TARGET_ARCH_ABI)\libzlib.a line on each prebuilt library fixed the problem. Basiclly, it chooses the appropriate library on each compile & install.