简体   繁体   中英

How to uninstall Android App with root permissions?

I wrote something to uninstall (delete) an App and have now the problem that the apk seems to be deleted but the app is not really deleted from phone..

The supposedly deleted app still exists in the launchers app drawer. And I can open the app, but it force closes the app.

I tested the procedure with an own App (existing at /data/app, not /system/app). With systemapps I didn't test.

Here the code:

private void delApp() {
    String deleteCMD = "rm " + packageInfo.applicationInfo.sourceDir;


    Process process;
    try 
    {
        process = Runtime.getRuntime().exec("su");
        DataOutputStream os = new DataOutputStream(process.getOutputStream());
        os.writeBytes("mount -o remount,rw -t rfs /dev/stl5 /system; \n");          
        os.writeBytes(deleteCMD+"; \n");
        os.writeBytes("mount -o remount,ro -t rfs /dev/stl5 /system; \n");
        os.flush();

    } 
    catch (IOException e) 
    {
        e.printStackTrace();
    }      



}

I don't rightly know why what you're doing does not work, maybe someone else can shed some light on that.

You could try:

pm uninstall com.package.name

instead of your rm /package/dir/path method

I'm not sure if that works on apps in the /system/app directory , however.

Also, take a look at: Application launcher icon is not deleted from Home screen when uninstalling android app

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM