How to Install and Uninstall android application as system app / priv-app

To install any android application as a system app, ( which can’t be uninstalled from settings ), first important this is, the device on which we need to install apk has to be a rooted device with all the necessary permissions. The user devices which we purchase from off-the shelves market are mostly “user” devices which has restricted permission, hence in such devices there will be no way to install an application as system app, unless you root the device somehow.

But most of the development platforms are allready rooted, hence following commands will work on such,

Connect you device using usb cable and type below commands,

 $ adb shell push myname.apk /sdcard 
 $ adb shell 
 $ su 
 $ mount -o remount,rw /system 
$ mv /sdcard/myname.apk /system/app

If you want you app, to be have little more permissions related to system. ( Something like if your app needs to have almost all permissions and is important to the system ), in that case, use below command,

 $ mv /sdcard/myname.apk /system/priv-app 
 $ chmod 644 /system/app/myname.apk 
 $ chown -R root /system/app/myname.apk 
 $ chgrp -R root /system/app/myname.apk 
 $ mount -o remount,ro /system 
 $ reboot 

This app cant be uninstalled from settings.

Now, if you want to uninstall system app or priv-app, we just need to follow below steps as,

 $ adb shell 
 $ mount -o remount,rw /system 
 $ rm -rf /system/app/myname.apk 
 $ mount -o remount,ro /system 
 $ reboot 

Once the device is rebooted, you will see that app has been removed from system.

Source Reference:

Follow Lynxbee

Leave a Reply / Ask Question