android不能只编译静态库

android NDK自带例子:twolibs,如果只编译 static lib,出现不编译情况。如下注释掉 shared lib。
------------------------------------------------------------------------------ 
LOCAL_PATH:= $(call my-dir) 

# first lib, which will be built statically 

include $(CLEAR_VARS) 

LOCAL_MODULE    := libtwolib-first 
LOCAL_SRC_FILES := first.c 

include $(BUILD_STATIC_LIBRARY) 

# second lib, which will depend on and include the first one 

#include $(CLEAR_VARS) 

LOCAL_MODULE    := libtwolib-second 
#LOCAL_SRC_FILES := second.c 

LOCAL_STATIC_LIBRARIES := libtwolib-first 

#include $(BUILD_SHARED_LIBRARY) 
------------------------------------------------------------------------------ 

这是因为:

By default, the build system will only build the shared libraries listed in your Android.mk, and the modules they depend on.

You can force a static library to be built by defining APP_MODULES in your Application.mk, listing all the modules you want
to build explicitely. In your case, this would be:
 
APP_MODULES := libtwolib-first

To only build the static library.

 

posted @   Bigben  阅读(436)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示