Run an app on a multiple devices automatically in Android Studio

AndroidAndroid Studio

Android Problem Overview


I have two Android devices connected to my computer. When I try to run the app from Android Studio, then it always prompt me to choose the device. Is there any way to deploy the app on a multiple devices automatically - by clicking Run or even better with a shortcut?

Android Solutions


Solution 1 - Android

This is almost too easy, actually. When you see the list of devices come up after launching the app, just shift or control click each device you want it to launch on. Just discovered this by accident.

Solution 2 - Android

For new users, in Android Studio 2, you also need to disable "Instant Run" in Settings->Build, Execution, Deployment->Instant Run. See Instant Run.

With Instant Run, you only can work with one device at time.

UPDATE

In Android Studio 2.1, it is automatically disabled when run in multiples devices at time.

> Deploying to multiple devices > > Instant Run uses different techniques to perform hot, warm, and cold > swaps that are specific to the API level of the target device. For > this reason, while deploying an app to multiple devices at once, > Android Studio temporarily turns off Instant Run.

Solution 3 - Android

I got new update of Android Studio that is Android Studio 3.5

Android Studio 3.5
Build #AI-191.8026.42.35.5791312, built on August 9, 2019
JRE: 1.8.0_202-release-1483-b03 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows Server 2016 10.0

In this update they have added in-built option to run application on multiple devices.

> The IDE has a new drop-down menu that lets you quickly select which > device you'd like to deploy your app to. This menu also includes a new > option that lets you run your app on multiple devices at once.

enter image description here

Do update new version of Android Studio and Enjoy.

Solution 4 - Android

Just as a point of addition, if you want to run your tests on multiple devices, you can't select multiple devices in the device chooser dialog for a Test profile. Instead, you need to run the gradle command connectedCheck. This runs your tests on all devices connected. There's no embedded UI for it (like you get running tests on a single device), but it provides a link to a locally generated HTML file with the test summary.

You can run from command line, or within AS, look in the Gradle projects window under: App(or root project)->Tasks->verification.

Ref: https://stackoverflow.com/a/18592367/1544046: Describes for emulators, but works for devices as well

Solution 5 - Android

This feature is now available in Android Studio 4.2.0. Just "Select Multiple Devices..." as shown in the screenshot below.

Device Selection

Devices are remembered and the multi selection dialog does not need to be opened each time, deploy defaults to previous selection

Only caveat is that devices that are unplugged are not remembered on re-plug

Solution 6 - Android

In Android Studio Select Dropdown option as shown below, you can select Run on Multiple Devices

enter image description here

Now Select Checkbox, in my case I have selected two Samsung phones available and then click on Run button. This will install and launch application in both the devices.

enter image description here

P.S: I have tested this in Android Studio 4.0, but in every run you need to use mouse in Below Android Studio 4.1.1. From Android Studio 4.1.1, there is a option to set KeyMap.

In Android Studio 4.1.2, you can set KeyMap Shortcut key for Run on Multiple Devices. I have set ctl+alt+R in my case as shown in below:

enter image description here

Solution 7 - Android

As of Android Studio 2.3.3 Disable the Instant Run use Menu Run->Run App (in windows shift +click for device you want to deploy)

you can't deploy to multiple devices if you used run->debug app

Solution 8 - Android

It's easy to run all connected device every time. Just Select all connected device while Android Studio shows Select Deployment Target & Select "Use same selection for future launches".

N.B. Remember all devices run sequentially one by one.

enter image description here

Solution 9 - Android

In Android studio 3.5. Run on multiple devices.

enter image description here

Solution 10 - Android

Android Studio 2020.3.1 has the option to run on multiple devices, But we can find multiple runs by selecting multiple devices while selecting the device(s) to run.

> Run -> Select Multiple Devices -> Check devices want to run

enter image description here

Solution 11 - Android

Very Simple.

CTRL + Shift on every device.

That all

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiontomrozbView Question on Stackoverflow
Solution 1 - AndroiddamccullView Answer on Stackoverflow
Solution 2 - AndroidRafael GutiérrezView Answer on Stackoverflow
Solution 3 - AndroidPratik ButaniView Answer on Stackoverflow
Solution 4 - AndroidJCricketView Answer on Stackoverflow
Solution 5 - AndroidavalanchaView Answer on Stackoverflow
Solution 6 - AndroidShiv BuyyaView Answer on Stackoverflow
Solution 7 - AndroidSamView Answer on Stackoverflow
Solution 8 - AndroidShihab UddinView Answer on Stackoverflow
Solution 9 - AndroidlinkaipengView Answer on Stackoverflow
Solution 10 - AndroidMerlin JeyakumarView Answer on Stackoverflow
Solution 11 - AndroidRichard KamereView Answer on Stackoverflow