How to uninstall own app from /system/app?

46,024

Solution 1

Manual uninstall using ADB :
http://www.careace.net/2010/05/12/how-to-remove-android-apps-through-adb/

During website downtime (like now) see crawled snapshot here:
https://web.archive.org/web/20180222063358/http://www.careace.net/2010/05/12/how-to-remove-android-apps-through-adb/

Programmatically:

    public static void deleteFromSystem (final String file)
    {
        try 
        {
            if (new File(file).exists())
            {
                String  path        = new File(file).getParent();
                Process process     = Runtime.getRuntime().exec("su");
                DataOutputStream os = new DataOutputStream(process.getOutputStream());
                os.writeBytes("mount -o rw,remount /system; \n");
                os.writeBytes("chmod 777 "      + path + "; \n");
                os.writeBytes("chmod 777 "      + file + "; \n");
                os.writeBytes("rm -r "          + file + "; \n");
                os.writeBytes("mount -o ro,remount /system; \n");
                os.writeBytes("reboot \n");
                os.flush();
                os.close();
                process.waitFor();
            }
        } 
        catch (Throwable e) {e.printStackTrace();}
    }

Solution 2

Assuming you have root access to device:

adb shell
su
mount -o rw,remount /system
rm -rf /system/app/myApp.apk
rm -rf /data/data/com.example.myapp
mount -o ro,remount /system
exit
exit

Solution 3

adb shell rm /system/app/MyApp*
adb uninstall org.my.app

Solution 4

Uninstall Android App via adb


Refer : xda

adb devices

adb shell

pm list packages

pm uninstall -k --user 0 name of package

Solution 5

Im not sure if you have to do this on every device (may be it can be achieved just by root access on some devices ) but on htc desire you have to reboot to the recovery mode Then you can copy your apk to the sdcard and then using adb shell to the /system/app folder you should create a nandroid backup first

Share:
46,024
XXX
Author by

XXX

Updated on July 09, 2022

Comments

  • XXX
    XXX almost 2 years

    I'm able to install own application into /system/app using adb shell commands. But how to uninstall it? Is there any commands to do it? My phone is rooted.

  • sherif
    sherif over 12 years
    Im sorry I cant read :D anyway it should be possible to delete it in the recovery mode
  • Senthil Mg
    Senthil Mg almost 11 years
    I tried your snippet in my application.The has been removed from home screen.But I have a problem after uninstalling app and then to reinstalling app it manages its sharedpreference state. I need the preferences need to clear.
  • Behnam
    Behnam over 10 years
    This code gives the following IO Exception to me: Working Directory: null Environment: null Yes I used the correct app name.
  • XXX
    XXX over 10 years
    @ Campiador Have you root?
  • android developer
    android developer about 10 years
    I think that in the past, it succeeded without restarting. is this the best way to uninstall system apps?
  • iroiroys
    iroiroys over 5 years
    Thank you. you saved my a lot of time!