1

Is there a a way to run the command 'ant debug install' when there are multiple android devices connect through ADB?

I currently have two devices connect to ADB through wifi. When I run ant debug install I get the following error ad infinitum.

 [exec] error: more than one device and emulator
     [exec] - waiting for device -
     [exec] error: protocol fault (status read)
     [exec] - waiting for device -
     [exec] error: protocol fault (status read)
     [exec] - waiting for device -
     [exec] error: protocol fault (status read)
     [exec] - waiting for device -
     [exec] error: protocol fault (status read)
     [exec] - waiting for device -
     [exec] error: protocol fault (status read)
     [exec] - waiting for device -
     [exec] error: protocol fault (status read)

If I disconnect one of the devices, it will properly run.

I also tried

ant debug install [ip of specific device]

this provided the same erroneous results.

Is there a way I can install to both devices at once?

Scorb
  • 1,654
  • 13
  • 70
  • 144
  • FYI, Google has been steering developers away from Ant for builds for about two years. – CommonsWare Feb 04 '16 at 19:56
  • [Running adb commands on all connected devices](http://stackoverflow.com/questions/17882474/running-adb-commands-on-all-connected-devices) – Onik Feb 04 '16 at 19:56

1 Answers1

1

The android ant build script doesn't seem to support installing to all devices in one command. However, the install target does take an ant property called ${adb.device.arg}. You should at least be able to control to which device you want the app to get installed on from the command line, like so:

ant -Dadb.device.arg="-s <deviceid>" debug install

Now, if you can use one of the scripts described in here to retrieve a list of all connected device ids, you should be able to write a simple script to iterate the ant install command for each device.

Btw, if you are interested, the ant build xml file is included as part of the sdk and located in your sdk folder:

$ANDROID_SDK/tools/ant/build.xml
Community
  • 1
  • 1
hopia
  • 4,880
  • 7
  • 32
  • 54