修改Android手机的软件默认安装位置

如无意外,一般来说,android 手机的默认安装位置应该是手机内存,因为考虑到如输入法的软件需要常驻使用。

但对于手机 Room 较小的手机,自然是把如游戏等非关键程序安装在 SD 卡好,留出更多的空间给系统使用。

对于装有 ADT 的电脑来说,使用 ADB shell 即可修改手机的软件默认安装位置。

$ adb shell
$ pm setInstallLocation 2

InstallLocaion 的取值及意义如下:

  • 0: auto
  • 1: internal
  • 2: external

Update (2012-09-18)

不知是不是 4.0 后的更改还是 3.0 开始的,shell 命令有所不同了,简单来说就是从驼峰式改为了unix shell 风格

pm get-install-location: returns the current install location.
    0 [auto]: Let system decide the best location
    1 [internal]: Install on internal device storage
    2 [external]: Install on external media

pm set-install-location: changes the default install location.
  NOTE: this is only intended for debugging; using this can cause
  applications to break and other undersireable behavior.
    0 [auto]: Let system decide the best location
    1 [internal]: Install on internal device storage
    2 [external]: Install on external media

References

  1. install location
  2. manifest element: install

评论

《 “修改Android手机的软件默认安装位置” 》 有 5 条评论

  1. 小灰 的头像

    很少用到adb 不过确实很强大~

    1. 流年 的头像
      流年

      @小灰 如果不是做开发,一般也不怎么会用到这个

  2. 小年 的头像

    有待学习!

    1. 流年 的头像
      流年

      @小年 想起一句话,活到老,学到老

  3. […] Auto 或 Internal 了,需要重设,要不就安装到手机内存中了,这样我写 修改Android手机的软件默认安装位置 […]