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)
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).
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
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) ?
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
$
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With