17

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

20

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.

  • Pleaseee state for windows .çmd – ankeshbharti Feb 26 '14 at 7:55
  • 1
    Same, except for the command to run. I'm not a Windows user, so I cannot give you the equivalent; you could try adb.exe install *.apk in the hope it resolves the wildcards; but I'm not sure whether that works. – Izzy Feb 26 '14 at 8:02
  • I am trying this and I am getting bash - adb command not found. I am enabled debugged mode also in Mobile. – Sujay U N Mar 13 '17 at 10:22
  • @SujayUN have you installed ADB stuff on your computer? Follow up to the tag wiki if not :) – Izzy Mar 13 '17 at 10:53
6

Step 1. Open command prompt (CMD) and change directory to your "c:\apps"

Example: Code:

cd..
cd..
cd apps

Now you should see your path set as "C:\apps" in CMD.

Step 2. Create directory print.

In CMD "C:\apps" run: Code:

dir /s /b > print.txt

This will print all directory files and extensions but nothing else, like size and attributes into your "C:\apps" folder. Now you will see a "print.txt" file in your "c:\apps" folder. If you open it, you will see a list of all your APKs.

Step 3. Assuming you are using Notepad to view your "print.txt" file, press "CTRL+H". This will open the Find and Replace dialog box.

In Find type Code:

C:\

In replace type

adb install -r c:\

Hit enter and it will modify all the APKs with the adb install command. Save and close notepad.

Step 4. Now you need to rename that .txt extension in your "c:\apps\print.txt" to "print.bat". You need to have extension shown in windows. Google that if you dont know how to do that.

Once saved as a .bat file, simply execute and it will run through the sequence to install all your APK files without any prompts on your phone. Voila, and enjoy.

EXAMPLE:"c:\apps\print.bat"

adb install -r c:\apps\com.twitter.android-1.apk
adb install -r c:\apps\com.ups.mobile.android-2.apk
adb install -r c:\apps\com.vavni.android.battleship-1.apk
adb install -r c:\apps\com.viclabs.myRemote-2.apk
adb install -r c:\apps\com.waterflea.wifiscan-1.apk
adb install -r c:\apps\com.wyse.pocketcloud-1.apk
adb install -r c:\apps\com.xrath.jmsn-2.apk
adb install -r c:\apps\com.xtralogic.android.rdpclient-1.apk
adb install -r c:\apps\com.xtremelabs.android.speedtest-1.apk
adb install -r c:\apps\com.yahoo.mobile.client.android.im-1.apk
adb install -r c:\apps\com.yahoo.mobile.client.android.mail-2.apk
adb install -r c:\apps\com.yahoo.mobile.client.android.search-1.apk
adb install -r c:\apps\hongbo.bluescreen-1.apk
adb install -r c:\apps\info.marlan.sim-1.apk
  • 4
    I do not understand why people upvote any stuff without realizing that it has been stolen. Any derived/copied work which doesn't appropriately reference the original source and its author(s) is a shame on the practice of knowledge dissemination. Hannan, please follow How to reference material written by others. – Firelord Jan 9 '16 at 8:11
  • 1
    if it works it is upvoted. – beppe9000 May 12 at 13:54
2

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.

  • 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 Mar 13 '17 at 10:25
  • @SujayUN Okay, replace adb with the direct path to your adb.exe in quotes and that should work. – Pyroglyph Mar 14 '17 at 10:20
0

you can install apk directly from your computer to Android mobile through ADB. First download adb and install it.you can download it from here if you did not have it already.

https://dl.google.com/android/repository/platform-tools_r28.0.1-windows.zip

then enable developer mode in your mobile. you can find it your 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

here my adb located is owner folder and

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

You can try below command from terminal,

adb install app-debug.apk

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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