Today I was asked to build an android application which should go into /system/app rather than being 3rd pary app /data/app
I had written below make file which looks pretty similar to Email app which comes by default with the android source code.
I will explain you what exactly some of the tags means in Android.mk
Note: Place your application inside $(Android_root_path)/packages/apps
Your android application might contains below files/folders
Example: if your application name is "xyz"
1. src/
2. res/
3. libs/
4. AndroidManifest.xml
5. assets/
6. default.properties etc...
Place this Android.mk in your application folder has the files placed above and compile entire source code $(Android_root_path)# make
Output: You will generate apk file out of your application which will go with your /system/apps. Everytime you need not have to install this application like your 3rd party applications.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
#This tag is must for making it system apps
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
#Any aidl files in your application can be added here
LOCAL_SRC_FILES += \
src/com/android/xyz/services/IxyzServiceCallback.aidl \
src/com/android/xyz/services/IxyzService.aidl
LOCAL_JAVA_STATIC_LIBRARIES := \
# include the prebuilt static library which is mentioned in
#LOCAL_PREBUILT_STATIC_JAVA_LIBARIES
LOCAL_STATIC_JAVA_LIBRARIES := liblog4j
LOCAL_PACKAGE_NAME := xyz
LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.cfg
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
#include any prebuilt jars you are using in your application which is present in
#libs folder of your package
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := liblog4j:libs/log4j.jar
include $(BUILD_MULTI_PREBUILT)
include $(call all-makefiles-under,$(LOCAL_PATH))
I had written below make file which looks pretty similar to Email app which comes by default with the android source code.
I will explain you what exactly some of the tags means in Android.mk
Note: Place your application inside $(Android_root_path)/packages/apps
Your android application might contains below files/folders
Example: if your application name is "xyz"
1. src/
2. res/
3. libs/
4. AndroidManifest.xml
5. assets/
6. default.properties etc...
Place this Android.mk in your application folder has the files placed above and compile entire source code $(Android_root_path)# make
Output: You will generate apk file out of your application which will go with your /system/apps. Everytime you need not have to install this application like your 3rd party applications.
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
#This tag is must for making it system apps
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := $(call all-java-files-under, src)
#Any aidl files in your application can be added here
LOCAL_SRC_FILES += \
src/com/android/xyz/services/IxyzServiceCallback.aidl \
src/com/android/xyz/services/IxyzService.aidl
LOCAL_JAVA_STATIC_LIBRARIES := \
# include the prebuilt static library which is mentioned in
#LOCAL_PREBUILT_STATIC_JAVA_LIBARIES
LOCAL_STATIC_JAVA_LIBRARIES := liblog4j
LOCAL_PACKAGE_NAME := xyz
LOCAL_PROGUARD_FLAGS := -include $(LOCAL_PATH)/proguard.cfg
include $(BUILD_PACKAGE)
include $(CLEAR_VARS)
#include any prebuilt jars you are using in your application which is present in
#libs folder of your package
LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := liblog4j:libs/log4j.jar
include $(BUILD_MULTI_PREBUILT)
include $(call all-makefiles-under,$(LOCAL_PATH))
No comments:
Post a Comment