Set Device for Android Plugin


(bogaty_f1) #1

Hello Guys,

Is ther any way to configure android plugin in Gradle, so that to pick up a device to use? I have sev eral devices connected to my machine, but I wasnt only one device to be running tests.

Official documentation, don’t says anything about that, the only I found there is:

  If more than one device is connected, all tests are run in parallel on all connected devices. If one of the test fails, on any device, the build will fail.  

(Radim Kubacki) #2

Better to ask at http://groups.google.com/group/adt-dev Or you can check if running the build with --info or --debug reveals some details how the device is selected.


(bogaty_f1) #3
  1. –info, or --debug is not giving normall information:
      15:56:01.613 [DEBUG] [org.gradle.api.Project] DeviceConnector ‘GT-I9300 - 4.0.4’: installing…  15:56:01.618 [DEBUG] [org.gradle.api.Project] DeviceConnector ‘GT-I9000 - 2.3.6’: installing…  

while devices are having something like 16 digit id, it is visible if you type in a cmd:

adb devices

started to look through the src. First view says that something with ant-configurations. :\ Seems to me it is impossible to confire it from task configuration block.

  1. Have made a question on the resource, you’ve mentioned. But I even can’t see it, after I pushed “published”. If there will be some talk, will give a link here.

Thanks, for advices, but still issue is not resolved.

  1. The only way I see is to rewrite the tasks for myself, but I don’t really like that.

(Radim Kubacki) #4

Related links: https://code.google.com/p/android/issues/detail?id=59894 is an open issue, https://github.com/novoda/gradle-android-command-plugin can help you to deploy independently.


(bogaty_f1) #5

hm… this looks interesting! Will check it, after finish a pralel task. Thanks!!!


(bogaty_f1) #6

Thanks for answer about this plugin. It has pretty simple source code, but it has not so many capabilities.From the things I needed it can:

  • install aplication(which is building with android plugin) on selected device. - install and run application. What I needed is: - make config for task ‘connectedAndroidTest’, which is installing two applications(main and test). executing test application, and uninstalling applications.

This can’t be performed with this android-command-plugin.

So currently I’ve resolved it for my project in the next way: Created 7 tasks of Exec type, where I am typing adb command that I need: uninstal -> instal -> run -> uninstal.