简体   繁体   English

在Android NDK中预建其他类型的静态库

[英]Prebuilding different kind of static library in Android NDK

Is there any way that we can build different kind of static libraries (.a extension files) at once, that we created through our NDK ? 有什么方法可以一次构建通过NDK创建的不同种类的静态库(.a扩展文件)? I think you'll understand better when i shared the code. 我认为当我共享代码时,您会更好地理解。

Android.mk -> 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 . 我包含的静态库是从使用BUILD_STATIC_LIBRARY创建的/ obj文件夹中复制的。 How can I prebuilt them all at once and include them ? 我如何一次将它们全部预建并包括在内? Sorry for the bad English and thanks in advance ! 对不起,英语不好,谢谢!

I was able to find the answer with the variable, TARGET_ARCH_ABI . 我能够找到变量TARGET_ARCH_ABI的答案。 Adding LOCAL_SRC_FILES := ..\\obj\\local\\$(TARGET_ARCH_ABI)\\libzlib.a line on each prebuilt library fixed the problem. 在每个预构建的库上添加LOCAL_SRC_FILES := ..\\obj\\local\\$(TARGET_ARCH_ABI)\\libzlib.aLOCAL_SRC_FILES := ..\\obj\\local\\$(TARGET_ARCH_ABI)\\libzlib.a此问题。 Basiclly, it chooses the appropriate library on each compile & install. 基本上,它会在每次编译和安装时选择合适的库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM