Run an app on a multiple devices automatically in Android Studio

余生长醉 提交于 2020-01-09 07:05:29

问题


I have a multiple Android devices connected to the computer. When I try to run the app I'm developing, the Android Studio 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?


回答1:


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. Hope it helps.




回答2:


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.




回答3:


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




回答4:


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.

Do update new version of Android Studio and Enjoy.




回答5:


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




回答6:


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.




回答7:


In Android studio 3.5. Run on multiple devices.




回答8:


Very Simple.

CTRL + Shift on every device.

That all



来源:https://stackoverflow.com/questions/17496875/run-an-app-on-a-multiple-devices-automatically-in-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!