Original address: https://blog.csdn.net/tkwxty/article/details/43341217
The writing of various Android.mk under Android source code
The new year is coming, the company is in recession, so there are not many things to be busy. Just take the time to summarize the writing of various modules Android.mk under Android source code! I won't describe Android.mk's syntax and details in detail here, because there is a lot of knowledge about this on the Internet. I'm listing several frequently used module writing examples here. I hope it can help the new Android people who are developing under the Android source code. There is no more nonsense and it goes straight to the example.
1. Write and generate a common APK. The APK does not contain the. so file or reference the third-party jar package
- # Copyright 2011 The Android Open Source Project
- LOCAL_PATH:= $(call my-dir)
- include $(CLEAR_VARS)
- LOCAL_MODULE_TAGS := optional
- LOCAL_SRC_FILES := $(call all-java-files-under, src)
- LOCAL_PACKAGE_NAME := CoshipUpgrade
- LOCAL_CERTIFICATE := platform
- include $(BUILD_PACKAGE)
- # This finds and builds the test apk as well, so a single make does both.
- include $(call all-makefiles-under,$(LOCAL_PATH))
- LOCAL_PATH:= $(call my-dir)
- include $(CLEAR_VARS)
- LOCAL_MODULE_TAGS := optional
- LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)/apk
- LOCAL_SRC_FILES := $(call all-subdir-java-files)
- LOCAL_STATIC_JAVA_LIBRARIES := cling-core-1.0.5 \
- cling-support-1.0.5 \
- teleal-common-1.0.13 \
- universal-image-loader \
- core-zxing
- LOCAL_PACKAGE_NAME := coshareservice
- LOCAL_CERTIFICATE := platform
- #LOCAL_JNI_SHARED_LIBRARIES := libmouse_cmd
- include $(BUILD_PACKAGE)
- MY_PATH := $(LOCAL_PATH)
- LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := cling-core-1.0.5:libs/cling-core-1.0.5.jar \
- cling-support-1.0.5:libs/cling-support-1.0.5.jar \
- teleal-common-1.0.13:libs/teleal-common-1.0.13.jar \
- universal-image-loader:libs/universal-image-loader-1.9.2-SNAPSHOT-with-sources.jar \
- core-zxing:libs/core.jar
- include $(BUILD_MULTI_PREBUILT)
- #include $(call all-makefiles-under,$(LOCAL_PATH))
3. Precompiled translation only provides APK without source code, and does not contain. so files
- LOCAL_PATH := $(call my-dir)
- ###############################################
- include $(CLEAR_VARS)
- LOCAL_MODULE_TAGS := optional
- LOCAL_MODULE := FlyUI_Wallpaper_mtk
- LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)/apk
- LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
- LOCAL_MODULE_CLASS := APPS
- LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
- LOCAL_CERTIFICATE := platform
- include $(BUILD_PREBUILT)
4. Precompiled translation only provides APK without source code, and does not contain. so files
- LOCAL_PATH:= $(call my-dir)
- ###############################################
- include $(CLEAR_VARS)
- LOCAL_MODULE_TAGS := optional
- LOCAL_MODULE := YOUKU
- LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
- LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
- LOCAL_MODULE_CLASS := APPS
- LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
- LOCAL_CERTIFICATE := platform
- include $(BUILD_PREBUILT)
- include $(CLEAR_VARS)
- LOCAL_PREBUILT_LIBS := libhello-jni.so
- LOCAL_MODULE := libhello-jni
- LOCAL_MODULE_TAGS := optional
- include $(BUILD_MULTI_PREBUILT)
- include $(CLEAR_VARS)
- LOCAL_PREBUILT_LIBS := libalgmsyoukutv.so
- LOCAL_MODULE := libalgmsyoukutv
- LOCAL_MODULE_TAGS := optional
- include $(BUILD_MULTI_PREBUILT)
- include $(CLEAR_VARS)
- LOCAL_PREBUILT_LIBS := libluajavayoukutv.so
- LOCAL_MODULE := libluajavayoukutv
- LOCAL_MODULE_TAGS := optional
- include $(BUILD_MULTI_PREBUILT)