Introduction: Android - the Complete Guide for Moving Installed Apps Using ADB and Changing the Default Install Location

About: I like to improve myself and things I find :) Learning new things every day is next to impossible but I still try - only a working brain can work. I have no special sector to cover, electronics, electrical stu…

Disclaimer:

I can not say if the methods explained will work on all devices, if in boubt you will need a rooted device and root access through ADB.

There is always a chance it will not work, so make a backup first as I won't accept complaints about data loss.

There are a lot of programs out there to move or link apps installed on the internal memory to your SD card.

The downside of this is that you need extra programs to do the job and that in most cases it is next to impossible to revert such changes.

In Kitkat and Lollipop you can be lucky and find some apps you can move through the app manager - try that first.

Devices with very limited system space and not much more on the emulated SD card might want to set the install location of apps to the SD card by default.

For this however you will need a rooted device.

Here in the first part I will show you the commands needed to move apps from the internal memory to the SD card and back.

The second part will show how to set the SD card as your default installation location.

What you need:
Device and ADB drivers for your Android
The SDK for your device, for many devices you can find a much smaller install packet which contains just the things you need for drivers and using ADB.
Please seek info on how to install the stuff yourself as I can't give advice for all devices out there.

Steps 1- 5 can be skipped if you don't know the name of the install file and like to proceed with the package name instead.

You can find a lot of info on the ADB commands on the net and even in some Instructables, but the either miss some info or won't give you any real world example.

If you get error messages in regards to the security, while using these commands, it means you have no rot access through ADB.
To do this you need rooted devices and an unsecure bootloader.

If your kernel does not support this you can try the app "ADB Insecure".

This app will temporarily set the bootloader to insecure mode, after that you can connect the cable and proceed as planned.

In case you still get the security error, try the direct and complete way for th ADB commands:

If in doubt I recommend downloading the PDF version as in the browser the command lines might appear in two lines istead of being a single line.

1. adb devices
This will show you if your device is recognised (USB debugging enabled).
If nothing shows up you have to fix either your drivers or activate USB debugging.
Also make sure to allow root for ADB in the developer options.

2. adb shell
You now see a weird command prompt, if you get an error something is still wrong.
First you see only half of the prompt, once you see / $ at the end of the prompt you can proceed.

3. su
This gives you super user right, e.g. full root access.
Again wait for the full command prompt.
Step 3 is only needed if you get security error messages with the following commands.

4. pm install -s -r /data/app/org.videolan.vlc.betav7neon-1.apk pkg: /data/app/org.videolan.vlc.betav7neon-1.apk
As an example for the VLC video player. - all in one line in case you browser shows two for the command.
Use the filename of the installation package of your app instead of org.videolan.vlc.betav7neon-1.apk
This line moves an app from the internal storage to the newly set SD card.
Pay attention as not the app folder but the apk file of the installation is used for this.

5. pm install -f -r /mnt/asec/org.videolan.vlc.betav7neon-1/pkg.apk pkg: /mnt/asec/org.videolan.vlc.betav7neon-1/pkg.apk

This moves the VLC player back from SD to internal memory. Again all in one line.

If you don't know the name of the install file you can try it over the package name as follows.

6. adb list packages -3 -i
To show the installed programs, needed if you want to move the app without knowing where the apk file is located.
This won't list system apps, to see those use the command without -3 -i
You will need the package name and the installer type.

7. adb shell
As above in step 2.

8. su
As above in step 3.

7. 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
This will move the VLC player to the SD card while keeping the informations about the installer, this can be helpful when you want to uninstall something through the app manager. Again all in one line.
"com.android.vending" was listed behind the package name after step 6 for your app it might be different or "null".

10. 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
Again this moves the VLC player to the internal memory. And again all in one line.

Step 1: Setting the SD As the Default Install Location

First things first....

Attempting this is not a solution for everything and might not work on your device.

I tested it with Android 5.0.2 Lollipop and it was still working, although full root access including ADB is required.

As with the previous part you will need the drivers and SDK for your device.

It might work on some unrooted devices but in most cases you will require root and super user rights.

You can try without root and without step 3 but if it fails you know why it failed.

Not all programs can be moved and not all programs will install everything to the location specified.

Some install the main data by default to the SD card but keep updates and ser data on the internal memory or even in the /data/data/ folder in the root. The Walking dead is a good example ox mixed installations that can't be moved.

But for GB apps like Asphalt8 it works just fine.

1. adb devices
This will show you if your device is recognised (USB debugging enabled).
If nothing shows up you have to fix either your drivers or activate USB debugging.
Also make sure to allow root for ADB in the developer options.

2. adb shell
You now see a weird command prompt, if you get an error something is still wrong.
First you see only half of the prompt, once you see / $ at the end of the prompt you can proceed.

3. su
This gives you super user right, e.g. full root access.
Again wait for the full command prompt.
Step 3 is only needed if you get security error messages with the following commands.

4. pm get-install-location
This will show you the current status of the install path.
0 = Auto - the app decides
1 = Internal
2 = SD card - on devices with no SD card slot it will use the emulated SD card.

5. pm set-install-location 2
This will set it to the SD card - to change back use the same command but 0 or 1 as a value.

You can check for success by repeating step 4.