当我们需要单独编译安卓系统的某个模块供应用使用时,就需要自己编写或修改Android.mk文件,下面就对Android.mk中两个容易混淆的概念(LOCAL_WHOLE_STATIC_LIBRARIES和LOCAL_STATIC_LIBRARIES)进行分析。
先看看谷歌的官方文档:
LOCAL_STATIC_LIBRARIES
These are the static libraries that you want to include in your module. Mostly, we use shared libraries, but there are a couple of places, like executables in sbin and host executables where we use static libraries instead.
LOCAL_WHOLE_STATIC_LIBRARIES
These are the static libraries that you want to include in your module without allowing the linker to remove dead code from them. This is mostly useful if you want to add a static library to a shared library and have the static library's content exposed from the shared library.
从以上内容可知,LOCAL_WHOLE_STATIC_LIBRARIES会加载整个静态库,LOCAL_STATIC_LIBRARIES只是加载静态库中用到的函数。看起来它们作用只是使最终生成的库文件大小不一样而已,但是