如何使用root权限卸载Android App? [英] How to uninstall Android App with root permissions?

查看:40
本文介绍了如何使用root权限卸载Android App?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一些东西来卸载(删除)一个应用程序,现在遇到的问题是 apk 似乎被删除了,但该应用程序并没有真正从手机中删除..

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.

我使用自己的应用程序(存在于/data/app,而不是/system/app)测试了该过程.使用 systemapps 我没有测试.

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

代码如下:

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.

你可以试试:

pm uninstall com.package.name

代替你的 rm/package/dir/path 方法

不过,我不确定这是否适用于 /system/app 目录 中的应用.

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

另外,看看:卸载Android应用程序时,应用程序启动器图标不会从主屏幕中删除

这篇关于如何使用root权限卸载Android App?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆