Hello Guys !! Hope you all doing well.
Today I am going to discuss how to add android app as a system app. First question, What is system App.?
You can say , The App which came as pre-installed or as a system.img (AOSP system image as a android OS), called system App. System app can easily access some platform(app-framework) level API call.
As for example Camera buffer. System App is not easily uninstalled by user, so it is a type of must have app as a android OS for a specific vendor(HTC, MOTO, Samsung).
Now how we can make an app as a system App.
Step 1 Create a folder inside packages/apps/
First create a folder for your app ( Let say MyTestApp) inside packages/apps/ of your android AOSP downloaded source code.
Then create a Android.mk file inside the folder(MyTestApp).
and in last copy your app source code inside the folder(MyTestApp) as for example following folder and file
Step 3 put your app name in build/target/product/ folder
open core.mk file from build/target/product/ folder and add your app name(MyTestApp) in
PRODUCT_PACKAGES tag at the bottom MyTestApp.
Note :-
for specific vendor you can find the path like this vendor/manufacturer/device/vendor_device.mk
Now step by step procedure for .apk file
Step 1 will be same like above
only change is that in place of src, res folder just put your .apk file.
step 2 open Android.mk file and add folowing code Snippet
This is all about how to make an android app as a system App.
One more question here?
if you have an .apk and you want to install it as a system app through command line(adb) in your phone then ???
in that case we have to push the .apk to the phone to the System partition. the path of the folder is /system/app or /system/priv-app (Android 4.3) using adb
Thanks Guys!!!
Happy Coding...
Today I am going to discuss how to add android app as a system app. First question, What is system App.?
You can say , The App which came as pre-installed or as a system.img (AOSP system image as a android OS), called system App. System app can easily access some platform(app-framework) level API call.
As for example Camera buffer. System App is not easily uninstalled by user, so it is a type of must have app as a android OS for a specific vendor(HTC, MOTO, Samsung).
Now how we can make an app as a system App.
- Have source code
- Have .apk Only
Step 1 Create a folder inside packages/apps/
First create a folder for your app ( Let say MyTestApp) inside packages/apps/ of your android AOSP downloaded source code.
Then create a Android.mk file inside the folder(MyTestApp).
and in last copy your app source code inside the folder(MyTestApp) as for example following folder and file
- assets,
- build,
- res,
- src and
- AndroidManifest.xml etc
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
LOCAL_CERTIFICATE := platform LOCAL_SRC_FILES
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := MyTestApp
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_PRIVILEGED_MODULE := true
LOCAL_STATIC_JAVA_LIBRARIES := libarity android-support-v4
include $(BUILD_PACKAGE)
include $(call all-makefiles-under,$(LOCAL_PATH))
save this mk file.Step 3 put your app name in build/target/product/ folder
open core.mk file from build/target/product/ folder and add your app name(MyTestApp) in
PRODUCT_PACKAGES tag at the bottom MyTestApp.
Note :-
for specific vendor you can find the path like this vendor/manufacturer/device/vendor_device.mk
Now step by step procedure for .apk file
Step 1 will be same like above
only change is that in place of src, res folder just put your .apk file.
step 2 open Android.mk file and add folowing code Snippet
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
LOCAL_MODULE := MyTestApp
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
# if Apk is signed then use it. Otherwise use platform
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
Step 3 will be same as above mention for Android source code (a)This is all about how to make an android app as a system App.
One more question here?
if you have an .apk and you want to install it as a system app through command line(adb) in your phone then ???
in that case we have to push the .apk to the phone to the System partition. the path of the folder is /system/app or /system/priv-app (Android 4.3) using adb
adb root
adb remount
now place your apk file in sdcard like thisadb push my-app.apk /sdcard/
adb shell
su
cd /sdcard
mv my-app.apk /system/app
# or when using Android 4.3 or higher
mv my-app.apk /system/priv-app
All System-Apps need to have the permissions rw-r--r--. So we can change them via adb with the change mode command like chmod 644 /path_to/your_file Thanks Guys!!!
Happy Coding...