How to uninstall an android app from command line on the device

前端 未结 8 1686
死守一世寂寞
死守一世寂寞 2020-12-12 17:15

I can uninstall an app on the device from my computer using adb uninstall , but I\'d like to do the same with a script on the actual device.

相关标签:
8条回答
  • 2020-12-12 17:51

    To forcefully uninstall the system user apps:

    Use:

    adb shell pm uninstall --user 0 <package_name>
    
    0 讨论(0)
  • 2020-12-12 17:51

    Simple command to remove any app from the device, try this:

     pm uninstall --user 0  

    This command will forcefully remove that app from the device.

    0 讨论(0)
  • 2020-12-12 17:56

    I had fail on uninstall some system launchers (for example NovaLauncher) In this case I recommend to use "disable" instead "uninstall":

    pm disable <package_name>
    

    In result you hide this system launcher (sys app) from list of launchers when you have a few launchers

    0 讨论(0)
  • 2020-12-12 17:59

    Some Apps can't be uninstalled,so below command gives the error:

    adb shell pm uninstall package_name
    Failure [DELETE_FAILED_INTERNAL_ERROR]  

    Try to run disable command instead,

    adb shell pm disable package_name
    Package package_name new state: disabled 

    0 讨论(0)
  • 2020-12-12 18:04

    adb shell pm uninstall *your.package.name*

    Did the trick for me.

    0 讨论(0)
  • 2020-12-12 18:08

    And if you want to re-install back package removed for a user (i.e. pm uninstall --user 0), without root:

    pm install --user 0 $(pm dump <package name> | awk '/path/{ print $2 }')
    

    This will locate .apk of the uninstalled package: pm dump <package name> and search for a line starting with path: to obtain path to the .apk (note that pm path <package> won't work for an uninstalled app) and install it using pm install --user 0 (note that pm install without --user argument wont' work).

    This works for any system app, this is a good alternative to pm disable-user <package> which still allows you to easily enable app back via Settings. For example, you could uninstall Play Store (pm uninstall --user 0 com.android.vending) and have no way to enable/install any application on default non-rooted device without access to adb or pm.

    0 讨论(0)
提交回复
热议问题