3

解释

我的问题的目标是知道如何创建一个可以构建和运行的Android.mk(makefile),这个项目结构如下。

  1. 图书馆(是eclipse上的图书馆)
    • [/data/projectLibrary/]
  2. 项目(界面)
    • 包含 1 个静态库 (lib1.jar)
    • 依赖于上述库
    • [/数据/projectUI/]
  3. 项目(服务)
    • 包含 2 个静态库(lib1.jar、lib2.jar)
    • [/数据/项目服务/]

问题

  1. 每个“项目”都应该有一个 Android.mk 吗?
  2. 或者我应该有一个包含所有其他“项目”的 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))

其他

我已经在网上找了,

[]的

4

1 回答 1

2
  1. 不,它不需要。
  2. 是的。可以参考“packages/apps/Dialer”下的aosp源码。刚好符合你申报的情况。拨号器包括“packages/app/ContactsCommon”和“packages/app/InCallUI”。你会发现InCallUI的路径下没有Android.mk。
于 2015-06-07T10:22:35.440 回答