21

I want to batch install apks from my desktop directly. Such as I downloaded many apks on the desktop and want to install apks without actually touching my android.

How to do this?

1

9 Answers 9

21

That's done easiest using (see the ADB tag-wiki for details on what ADB is and how to get/install it on your machine). As you don't state the OS you're using on your desktop, I write how it could be done on Linux (which I work with); should be easily adaptable to other platforms:

  • put all your downloaded .apk files into a single folder
  • connect your Android device, and make sure it's recognized (adb devices should list a connected device)
  • open a terminal/command prompt, and change to the directory where your .apk files reside
  • run for file in *.apk; do adb install $file; done
  • watch all the apps getting installed, without requiring any further interaction :)

NOTE: If you have .apk files which have "spaces" in their names such as 'Xposed Framework', 'Adobe Flash Player' etc. then you will have to rename them, as ADB cannot handle that. Either remove the spaces altogether, or replace them e.g. by underscores. Linux provides a Perl script for that (/usr/bin/rename) which you can use:

rename 's/ /_/g' *.apk

It replaces all space character with _, which makes names like this Xposed_Framework, Adobe_Flash_Player which are recognizable by adb.

0
3

If you have apks in different folders (like if you used adb pull) then you can use my script below:

for /r %f in (*.apk) do adb install -r "%f"

Just run it in the folder above all your APK Files and it will recurse and install all of them.

2
  • I tried this and I am getting this C:\Users\AndroidApps>adb install "C:\Users\username\Downloads\AosApp\AppName.apk" 'adb' is not recognized as an internal or external command, operable program or batch file.
    – Sujay U N
    Commented Mar 13, 2017 at 10:25
  • @SujayUN Okay, replace adb with the direct path to your adb.exe in quotes and that should work.
    – Pyroglyph
    Commented Mar 14, 2017 at 10:20
0

For windows, open command line:

set PATH=%PATH%;C:\path_to_your_platform-tools\

then

for %e in (*.apk) do adb install %e
0

So you have a problem that you have tons of apps to install and you didn't do a backup like Titanium Backup or other backup-restore app. But one-by-one installing and confirming and waiting would take forever, not to mind it's so tedious!

I tried to find an app that could do it to save me the effort, but after trying them all, none of them worked. So I was doing it one-by one and it was taking so long that I decided to just do it with ADB.

No worries, I am here to save you, if you are using Windows. You can solve this using ADB. You might not know how to use ADB so I will write the full instructions here. Don't worry, it's easy.

How to do it in Windows:

On your phone,

  1. Be sure your phone's drivers are installed. For example, Samsung drivers or LG drivers form the manufacturer's website.
  2. Go into Settings > Developer Options (Click on Settings > About Phone > Software > Build Number 7 times to activate Developer mode)
  3. Turn on USB Debugging
  4. Turn OFF Verify apps over USB
  5. Connect your phone via a USB cable to your computer.
  6. On your phone select the popup that says allow USB Debugging. If you don't see it or missed it, just turn off and back on USB Debugging and it should pop up again if your phone is connected.

Now you are ready for the next step.

On your Windows computer:

  1. Download Android SDK Platform Tools
  2. Extract the platform-tools folder into your computer. I recommend the root of your C: drive, so that it is located at C:\platform-tools\
  3. Get all your APK files you want to batch install and put them into a folder and put it into your platform-tools folder. For example, you might make a folder named "apks" located at C:\platform-tools\apks\
  4. Open a CMD (Command Prompt) window. (Ideally, right-click and run as administrator just to be sure. It may not be necessary.)

Now, your phone is connected and you have ADB installed on your computer, so you are ready to enter the following into your command line.

First, test to see if your device is connected.

cd C:\platform-tools\

adb devices

If your phone is properly connected, you will see something like this:

* daemon not running: starting now at tcp:5037
* daemon started successfully
List of devices attached
Z1Z1Z1Z1Z1Z1    device

where Z1Z1Z1Z1Z1Z1 is the device ID of your phone.

If you saw that, you are successful. Proceed to do the install commend:

for %e in (apks\*.apk) do adb install %e

If it worked, success! Enjoy watching everything get installed quick. It's probably faster to do this than to manually install 300+ apks on your phone.

cmd window install


ISSUES AND SOLUTIONS

If you get the error more than one installed and you saw emulator-5556 under your device, try this (or you can skip to the end and see the way to get around this problem):

  1. reboot phone
  2. adb kill server in the CMD window
  3. When phone finished rebooting, type: adb devices
  4. If it worked and only your phone shows, then great!
  5. Type again adb kill server in the CMD window (don't check adb devices again)
  6. If you still see emulator then try these instructions.

Then run the final command and watch everything get installed.

  • If you get error "FAILED ALREADY EXISTS" it is because the app already exists on your phone and it won't reinstall it, it will only install apps which are not installed yet.
  • If you get your phone crash and disconnect, it's because the screen timed out while it was installing. You could swipe the screen on the desktop occasionally and it should prevent it from sleeping and blocking your install making you start over.

All apps might not install because your computer is too fast for the command prompt and some might say "more than one device/emulator", while others install normally. In this case, I have a solution.

  1. Type adb devices. Take note of your device ID like the Z1Z1Z1Z1Z1Z1 in the output above.
  2. Specify your device ID after -s.

See an example command below:

for %e in (apks\*.apk) do adb -s Z1Z1Z1Z1Z1Z1 install %e

where Z1Z1Z1Z1Z1Z1 is the device ID of your phone.

This is going to make sure that ADB ignores any other devices and it will prevent the "multiple devices" error.

Hope it helps!

0

In addition to adb install, you can directly use package manager from adb shell to install apps. Place .apk files in /data/local/tmp and make sure files are readable, SELinux context must be u:object_r:shell_data_file:s0. Now:

~$ cd /data/local/tmp
~$ ls *.apk | xargs -I {} pm install '{}'

Another simple root solution - though not from computer - is to use some file explorer e.g. MiXplorer to batch install apps. Select all .apk files and tap on Install from menu.

0

For Linux, in the directory that APK is located, open terminal and type find . -name "*.apk" -exec adb install {} \;

0

For Windows:

Using ADB (Android SDK Installed & PATH set correctly) and Command Prompt on Windows

Run the following to make sure ADB is working

adb devices

Place all APKs in a folder

cd C:\your\path\to\folder\of\apks

for %e in (*.apk) do adb install "%e"

Improved version based on @thetechreader's answer (works for file names with space/symbols)

0

I just ran into the same situation. Am writing this soln which is enhancement from the ones given for two reasons
--You have a LOT of apps to install most likely your previous backup . Cant afford to keep phone connected . If your adb snaps you should know what you already installed and not waste time, going over everything again
--If some apps erred - need to know which ones and avoid them

I did this with adb shell but you can do it from outside much the same. My Apps were lying in my memory card partition.


for apk in `find  . -iname *apk -type f`  ; do  pm install $apk
 ( test $?  -ne 0  &&  mv $apk    $apk.ni )  || mv  $apk  $apk.ok ; done

sample output of bad installs

# find . -iname *.ni -type f                                                 
./org.satok.gweather-bSyZZ3_Zu8ElvJR_4l5sJg==/base.apk.ni
./com.teslacoilsw.launcher-AAZW9c2u4qCjIL3ZmVKsQg==/base.apk.ni
./com.linkedin.android-hLWhs0ddIZ2KWTRO-bZG_Q==/base.apk.ni
./com.google.android.apps.youtube.music-arEVgcC5NTbNUAwP-oYz6A==/base.apk.ni
./com.udemy.android--4YWw0rFLDSA-koaYxCsRA==/base.apk.ni
./com.theporter.android.customerapp-rKFfqbF4WgXvCouQ4ZcvUQ==/base.apk.ni
./com.vested.investing.android-tx7OKTeaemkmdOnomJqTGg==/base.apk.ni
./com.inscripts.namaste-TnRILvo6qbtjjen2r-BTSw==/base.apk.ni
./com.google.android.soundpicker-13nSUeHMYf5qIkXTC1I56Q==/base.apk.ni

and good installs

find . -iname *.ok -type f
./org.videolan.vlc-UMth4_20QtXe66eAx1qzRw==/base.apk.ok
./com.zoho.meeting-0fFi8KgjQBd2N0OZcwdyqA==/base.apk.ok
./sulekha.yellowpages.lcf-JGBM0zpT3hVj2XShwoKvRw==/base.apk.ok
./com.teradata.tcapp-BjVV7TLB5aBUfbW32KzN2A==/base.apk.ok
./com.oasisfeng.greenify-_OK3qGqs7MsTO-QY5aKOeQ==/base.apk.ok

Its a good idea to also Id `apks` which have `split apks` within & move them elsewhere before you kick off the run.
-1

You can install APK directly from your computer to Android mobile through ADB. First, download ADB and install it. You can download it from Google's DL Repository if you did not have it already.

Then enable developer mode on your mobile. You can find it in the settings of your mobile.

And then run this command.

adb install "path to your apk file"

For example:

C:\Users\Owner>adb install C:\Users\Owner\Downloads\android-agent.apk
1
  • Note that this only installs a single APK, not a batch/multiple APKs at the same time.
    – Andrew T.
    Commented Aug 16, 2020 at 13:41

You must log in to answer this question.