7

How can I configure AndroidStudio such that the app is run on all connected devices without further inquiry even when I constantly plug in new devices / remove old ones?

Please note that this requires a slightly different approach than this solution, since with their procedure the device selection dialog appears again if you

  • connect another device

or

  • restart Android Studio
Community
  • 1
  • 1
PhilLab
  • 4,777
  • 1
  • 25
  • 77

3 Answers3

2

I found a bash script that has been working well for me for quite sometime:

adb devices | while read line
do
    if [ ! "$line" = "" ] && [ `echo $line | awk '{print $2}'` = "device" ]
    then
        device=`echo $line | awk '{print $1}'`
        echo "$device $@ ..."
        adb -s $device $@
    fi
done

All credits go the github user 'christopherperry'. For more info check this link:

https://gist.github.com/christopherperry/3208109

Hope this helps.

user2511882
  • 9,022
  • 10
  • 51
  • 59
  • 1
    Well, that is a good starting point, now this script has to be inserted in the AndroidStudio run configurations, I suppose? How do I find the apk just compiled by the IDE and how to I call this script with this parameter? – PhilLab Jan 13 '16 at 08:24
  • I can update the answer with some more details a bit later. I am currently working from a different machine.. – user2511882 Jan 13 '16 at 20:37
  • @user251182 are you now working on the same machine? :-) Was checking my old questions and noticed this one needs an answer to be accepted – PhilLab Jan 20 '17 at 10:31
1

The answer is pretty much same as the solution. The only thing to be done is "check" the checkbox that says "Always use the same device for future launches" As highlighted in the image

Be sure to select all devices before you click run, for the first time.

B.B.
  • 924
  • 2
  • 11
  • 28
0

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

Shihab Uddin
  • 6,699
  • 2
  • 59
  • 74
  • correct me if I am wrong, but the device selection dialog appears again if you a) connect another device or b) restart Android Studio – PhilLab Apr 09 '18 at 07:37
  • for new device the answer is yes. same for restart. but for same connected device it will not ask again if it is checked "Use same selection for future launches".. – Shihab Uddin Apr 09 '18 at 10:02
  • then this is the same approach already mentioned in the question – PhilLab Apr 19 '18 at 08:10