How to Install an APK File From Computer Using ADB Command Prompt

How to Install an APK File From Computer Using ADB Command Prompt

You just downloaded apk file on your computer and plan to install it using command-line tools like Minimal ADB and Fastboot. It was a pretty good idea because it is not inconvenient to move the apk file to internal memory or SD Card and then install it on the phone.

Command-Line Tools

Download or other command-line tools and install it on your computer.

Put the apk file into the Minimum ADB and Fastboot installation directory C:\Program Files (x86)\Minimal ADB and Fastboot

Enable USB Debugging

To use adb with a device connected over USB, you must enable USB debugging in the device system settings, under Developer options. On Android 4.2 and higher, the Developer options screen is hidden by default. To make it visible, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options at the bottom.

On some devices, the Developer options screen might be located or named differently.

You can now connect your device with USB. You can verify that your device is connected by executing adb devices from the Minimal ADB and Fastboot. If connected, you'll see the device name listed as a "device."

Install an App

You can use adb to install an APK on an emulator or connected device with the install command:

The simple way to do that is by command

adb install example.apk

This apk is installed in the internal memory of current opened emulator.

adb install -s example.apk

You can also install an apk to specific device in connected device list to the adb.

adb -s emulator-5554 install myapp.apk

And if you want to target connect device you can add parameter " -d "

adb install -d example.apk

If you have more than one device/emulator connected you will get this error:

To avoid that you can list all devices by below command

adb devices

You will get results like below:

C:\Windows\System32>adb devices 
 List of devices attached 
 a3b09hh3e  device 
 emulator-5334  device

Choose one of these devices and add parameter to adb command as " -s a3b09hh3e " as below

adb -s a3b09a6e install example.apk

Also as a hint if the path of the apk long and have a spaces, just add it between double quotes like

adb -s a3b09a6e install "c:\my apk location\here 123\example.apk"