4

Background

It is possible to set the default installation to the SD card by using (based on this link) :

for pre- API14 :

adb shell pm setInstallLocation 2 

for API 14 and above:

adb shell pm set-install-location 2 (Android 4.x)

The problem

This only works for newly installed apps (or you just go manually over each of them and set it there), but I would like to know how to re-install an already installed app into the SD card (and also back to the internal storage).

What I've tried

I tried to read the commands available via ADB, and tried to run the next command:

adb shell pm install -s -r -i com.example.test

But it didn't work

The question

Suppose an app is already installed on the internal storage (or the SD card), how can I use ADB to re-install it to the SD card (or the internal) ?

4
  • 1
    Wish more questions are asked that way... Apr 24, 2014 at 22:14
  • @MarcinOrlowski in what way? the titles? I wish I could make a template since it's annoying to type it each time. if the question is too short i don't even bother. Apr 24, 2014 at 22:28
  • 1
    In the way that let anyone clearly understand what the problem is and how you tried to solve the problem yourself prior asking here. I am simply feed up with all this crappy "questions" containing huge amount of messy code OP clearly did not even tried to understand nor even tried to read i.e. stacktrace. Apr 25, 2014 at 8:14
  • 1
    most of the questions I ask are in this manner. only short ones that I really can't give any information I make super short and clear. Apr 26, 2014 at 16:20

1 Answer 1

8

Apparently, need to provide the location of the APK rather than the package name.

Following worked on my end for VLC that I installed from Play Store and was originally located in internal storage:

$ adb shell pm install -s -r /data/app/org.videolan.vlc.betav7neon-1.apk
    pkg: /data/app/org.videolan.vlc.betav7neon-1.apk
Success
$

And moving back to internal storage:

$ adb shell pm install -f -r /mnt/asec/org.videolan.vlc.betav7neon-1/pkg.apk
    pkg: /mnt/asec/org.videolan.vlc.betav7neon-1/pkg.apk
Success
$

Update 1

Following are respective commands with -i: specify the installer package name option.

Move to SD card:

$ adb shell pm install -i "com.android.vending" -s -r /data/app/org.videolan.vlc.betav7neon-1.apk
    pkg: /data/app/org.videolan.vlc.betav7neon-1.apk
Success

Move to internal storage:

$ adb shell pm install -i "com.android.vending" -f -r /mnt/asec/org.videolan.vlc.betav7neon-1/pkg.apk
    pkg: /mnt/asec/org.videolan.vlc.betav7neon-1/pkg.apk
Success

Update 2

Using -i is optional, but if it is not used the installer information is lost during movement:

$ adb shell pm list packages -3 -i
package:org.videolan.vlc.betav7neon  installer=com.android.vending

$ adb shell pm install -s -r /data/app/org.videolan.vlc.betav7neon-1.apk
    pkg: /data/app/org.videolan.vlc.betav7neon-1.apk
Success

$ adb shell pm list packages -3 -i
package:org.videolan.vlc.betav7neon  installer=null

Hope this helps.

16
  • 1
    Well, maybe you should specify the installer name when using -i option? :) Do you really need to use -i?
    – ozbek
    Apr 25, 2014 at 10:08
  • 1
    no but what is written there is misleading. I wonder why they need it if I give them the APK file anyway... I mean , why should I even use the "-i" ? Apr 25, 2014 at 10:35
  • 1
    I see. Please see Update 2
    – ozbek
    Apr 25, 2014 at 10:59
  • 1
    That's even weirder. Anyway, thank you for your help. Apr 25, 2014 at 12:38
  • 1
    Say, does it require a certain Android version in order to work? Aug 11, 2014 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.