简体   繁体   English

如何使用root权限卸载Android App?

[英]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.. 我写了一些东西卸载(删除)一个应用程序,现在有问题,似乎删除了apk但该应用程序并未真正从手机中删除..

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). 我使用自己的应用程序(存在于/ data / app,而不是/ system / app)测试了该过程。 With systemapps I didn't test. 使用systemapps我没有测试。

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 而不是你的rm /package/dir/path方法

I'm not sure if that works on apps in the /system/app directory , however. 但是,我不确定它是否适用于/system/app directory

Also, take a look at: Application launcher icon is not deleted from Home screen when uninstalling android app 另外,请看一下: 卸载Android应用程序时,不会从主屏幕删除应用程序启动器图标

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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