By user2239505

2013-04-11 15:15:58 8 Comments

I would like to know whether there is a way to tell Android to install applications on the micro SD card by default instead of having to download applications to internal memory first and then having to move them to the SD card manually.



@Abhilash 2016-07-29 04:24:39

Install "Terminal Emulator for Android" in your mobile and open

$ su
# pm get-install-location
# pm set-install-location 2
# pm get-install-location

@Robert S. Barnes 2017-05-22 07:05:30

interesting, but you have to have root for this to work

@Vibhor 2016-06-08 08:28:33

The thing is u can change the default install directory if your phone is rooted. Download lucky patcher and tap on tools there you can find option to change default install directort. **Do not do this for android 4 or above or it may cause irreversible change. **

@karel 2016-06-08 08:52:20

According to Android Version Market Share 2016 97.7% of all Android users are using Android 4.0 or later at the date when this answer was posted and therefore Lucky Patcher may cause irreversible changes to almost all current Android users.

@Izzy 2016-06-08 11:52:07

What "irreversible changes" would that be? I didn't notice them on my Kitkat devices :) But as @karel pointed out: If you think it shouldn't be used, why do you recommend it?

@Izzy 2013-04-11 16:40:00

This article at HowtoGeek describes a possible way utilizing the :

  • enable USB debugging
  • connect your device to your computer
  • execute the command adb shell pm setInstallLocation 2
    (or, new syntax, adb shell pm set-install-location 2)
  • disconnect, done.

This command will set the devices default installation target to your SDCard. That doesn't necessarily mean everything gets installed there: only apps supporting this will go there, and devs can "overrule" this in their apps manifest if they think it's needed. From the linked API reference:

Changes the default install location. Location values:

  • 0: Auto—Let system decide the best location.
  • 1: Internal—install on internal device storage.
  • 2: External—install on external media.

Note: This is only intended for debugging; using this can cause applications to break and other undesireable behavior.

For more details on ADB, and how you can e.g. get a minimal version of it to your computer (without the overkill of installing the entire SDK), you can take a look at the tag-wiki.

Update: To avoid confusion with t0mm13b's answer, some clearance on the installation process:

  1. you find some app on and decide to install it
  2. after you've clicked "install" and agreed on terms/permissions, the is downloaded to /data/local, i.e. to your . You can't change that.
  3. when the download is completed, the .apk will be installed automatically. Where to, depends on multiple things:
    • if the dev did not specify the android:installLocation property in his apps Manifest, the app will be installed to internal story. Full stop, no other choice (see: API reference).
    • if this android:installLocation is set to preferExternal, and external storage is available, it will go there.
    • if it's set to auto, it again depends:
      1. does the app contain widgets, services, wants to start at boot, and several other things, it goes to internal storage. Full stop, no other choice.
      2. it goes where the devices "default install location" points to

@t0mm13b 2013-04-11 18:08:50

might help to include a warning - its not guaranteed to work, especially if an app has their own widgets... :)

@Izzy 2013-04-11 18:22:56

As I wrote: only apps supporting this will go there :) Widgets, services, etc are telling it does not support it :)

@moudrick 2015-10-01 09:07:25

after executing the command adb shell pm setInstallLocation 2 error: device not found

@Izzy 2015-10-01 09:29:39

That sounds like you either skipped the first two steps (enabling USB debugging and connecting the device after that) – or you're on Windows and didn't install the corresponding drivers. Please follow the corresponding link and go on from there, @moudrick.

@zulqarnain 2014-10-04 10:35:21

Go to "Manage apps" and then select the "All" tab and find "Google Play Store". Tap on it and then press the "Uninstall updates" button. After that, go to the Play Store all the apps will be installed on your SD Card. This is what I did on my QMobile A110 (Android 4.2).

@Enigma 2014-10-20 18:45:23

I think you are missing the middle step somewhere where you set the default install location to be the SD card and even then, it doesn't always work this way for every application.

@t0mm13b 2013-04-11 15:23:18

That cannot be changed! That is how Android works.

All downloads from Google Play goes to the internal filesystem, then from:

  • Settings > Manage applications
  • Tap on said app, check if button Move to SDCard is enabled, then you can do so.

If the button Move to SDCard is disabled or greyed out, its probably to prevent the app from functioning - such as their own widgets on home screen.

Also, see this answer in the related side-bar to the right of this page. :)

@Izzy 2013-04-11 16:32:43

Are you sure, t0mm13b? Wasn't there some ADB command to adb shell pm setInstallLocation 2 (i.e. SDCard), as described here?

@t0mm13b 2013-04-11 17:53:49

A developer can specify that in the Manifest to give the app the capability to be moved to the SDCard. android:installLocation="auto" Have not seen adb shell pm setInstallLocation 2, presumably you specify the package name in that case...

@Izzy 2013-04-11 18:21:55

Nope, t0mm13b -- see my answer and the linked article. This sets the device's default install location. So if the Manifest says "auto", that's where it goes. If the Manifest says other than "auto", it goes where the Manifest says. See also: API ref, also here for the pm set-install-location (new syntax) command.

@t0mm13b 2013-04-11 18:44:51

Izzy - what I specified about AndroidManifest's android:installLocation - actually enables the Move to SDCard from the manage app settings...some devs do not specify it and renders the button being disabled but I concede - never seen the adb command to do that either

@Izzy 2013-04-11 19:14:44

Ah, now I get it -- different focus: You were saying "if an app is not intended to be installed on SD, you cannot do so" -- while I was focusing on where it goes to by default unless specified otherwise. But please check your answer's first 4 lines, they say something different. You are however correct: The download first goes to /data/local, and from there the app is installed. But depending on settings and manifest, it is installed either to internal or directly to external from there. // If you like to discuss this in detail: you remember our pub, ahem, chat? :)

Related Questions

Sponsored Content

Sponsored Content