解释
我的问题的目标是知道如何创建一个可以构建和运行的Android.mk(makefile),这个项目结构如下。
- 图书馆(是eclipse上的图书馆)
- [/data/projectLibrary/]
- 项目(界面)
- 包含 1 个静态库 (lib1.jar)
- 依赖于上述库
- [/数据/projectUI/]
- 项目(服务)
- 包含 2 个静态库(lib1.jar、lib2.jar)
- [/数据/项目服务/]
问题
- 每个“项目”都应该有一个 Android.mk 吗?
- 或者我应该有一个包含所有其他“项目”的 Android.mk?
Android MK(服务)
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_STATIC_JAVA_LIBRARIES := android-common
LOCAL_STATIC_JAVA_LIBRARIES += jsr305
LOCAL_STATIC_JAVA_LIBRARIES += android-common-chips
LOCAL_STATIC_JAVA_LIBRARIES += lib1
LOCAL_STATIC_JAVA_LIBRARIES += lib2
LOCAL_JAVA_LIBRARIES += telephony-common mms-common
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_SRC_FILES += $(call all-java-files-under, ../projectLibrary/src)
LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/res
LOCAL_RESOURCE_DIR += ../projectLibrary/res
# Include res dir from chips
chips_dir := ../../../frameworks/ex/chips/res
res_dirs := $(chips_dir) res
$(shell rm -f $(LOCAL_PATH)/chips)
LOCAL_RESOURCE_DIR += $(addprefix $(LOCAL_PATH)/, $(res_dirs))
LOCAL_AAPT_FLAGS := --auto-add-overlay
LOCAL_AAPT_FLAGS += --extra-packages com.android.ex.chips
LOCAL_REQUIRED_MODULES := SoundRecorder
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
LOCAL_CERTIFICATE := myCertificate
LOCAL_PACKAGE_NAME := MyAppName
include $(BUILD_PACKAGE)
# make the jni
include $(call all-makefiles-under, jni)
# make the static libs
include $(CLEAR_VARS)
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := lib1:libs/lib1.jar
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := lib2:libs/lib2.jar
include $(BUILD_MULTI_PREBUILT)
# make the other makefiles, if necessary
include $(call all-makefiles-under, $(LOCAL_PATH))
其他
我已经在网上找了,
- http://www.kandroid.org/online-pdk/guide/build_cookbook.html
- http://www.gdgankara.org/2011/12/29/understanding-android-makefile-android-mk/
- :(
[]的