Explanations
The goal of my question is to know how to create a Android.mk (makefile) that can build and run, this structures of project below.
- Library (is library on eclipse)
- [/data/projectLibrary/]
- Project (Interface)
- Contains 1 statics libraries (lib1.jar)
- Depend of Library above
- [/data/projectUI/]
- Project (Service)
- Contains 2 statics libraries (lib1.jar, lib2.jar)
- [/data/projectService/]
Questions
- I should have one Android.mk for each "project"?
- Or i should have one Android.mk that includes all the other "projects"?
Android MK (Service)
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))
Others
I already looked for it on the web,
- http://www.kandroid.org/online-pdk/guide/build_cookbook.html
- http://www.gdgankara.org/2011/12/29/understanding-android-makefile-android-mk/
- :(
[]'s