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:

Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense Multimedia - Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question