>From my experience I know that three parameters are extremely useful when
working with multiple devices on CI:
1. The timeout for installing apks, which can easily be reached if devices
are connected through a socket from a remote machine and when uploading big
apks.
2. The number of threads which access one adb server at the same time in
parallel. The broken pipe error seems to be system dependent, e.g. ubuntu
is worse than mac. For mac I found that 4 threads is the sweet spot.
3. A list of device serials which identify the devices to run tests on.
I wish all of these parameters would be configureable through the android
gradle plugin or from cli.
I know that the abstract DeviceProvider class has a getMaxThreads() method
which is currently hardcoded to 0 which causes the subsequent logic to use
as many threads as the system has processors. Maybe that logic could be
refactored to use 0 as a default and allow the property to be set from cli,
like: ./gradlew connectedCheck -DandroidMaxThreads=4.
Concerning the timeout I think the getTimeout() method of
the DeviceProvider would be the right place to start, though it seems that
the timeout is not used consistently. I found at least three different
timeouts used for running install/sync commands:
DdmPreferences.getTimeout(), System.getenv("ADB_INSTALL_TIMEOUT") and
DeviceProvider.getTimeout(). Obviously one can be configured from the user
already, although it might not have the expected effect. Maybe the
internals of the android tools could find some common ground to specify
those seemingly equivalent timeouts and maybe it would also allow to set
the timeout from within the gradle config or from cli (e.g. ./gradlew
connectedCheck -DandroidInstallTimeout=60000).
Concerning the serials (emphasis on plural), I am currently running a
self-patched version of the android gradle plugin which supports a system
property which allows to specify a set of serials to run on, e.g.
./gradlew connectedCheck -DandroidSerials=emulator-5554,emulator-5556
If there is an agreement, I would be happy to contribute this change to
upstream and I would also like to contribute to solutions for the timeout
and maxThreads problem.
On Tuesday, November 4, 2014 at 8:07:24 PM UTC+1, Kevin Brotcke wrote:
>
> Reviving this thread in case others stumble upon it. I recently added the
> ANDROID_SERIAL property support released in Android Gradle plugin 0.14.0
> (2014/10/31).
>
> https://code.google.com/p/android/issues/detail?id=75407
>
> On Thursday, April 4, 2013 10:45:07 AM UTC-4, Per Christian Henden wrote:
>>
>> Hi group!
>>
>> When executing the build I have multiple devices available for adb, and
>> this makes the InstallTask fail with an adb error ("more than one device
>> and emulator").
>> The reason for the multiple devices is that this happens on a build
>> server (Jenkins) where there are multiple Android projects building at the
>> same time, each using their own emulator.
>> To install an apk in this environment 'adb' must be given a device
>> serial, for example 'adb -s emulator-5554 install myapp.apk'.
>>
>> Do you have any suggestions on a workaround for this limitation in the
>> gradle plugin?
>> My ideas so far are to overwrite the InstallTask or to somehow supply the
>> ANDROID_SERIAL environment variable to the InstallTask.
>> When ANDROID_SERIAL is available, adb will use that device.
>>
>> Cheers
>> PC:
>>
>
--
You received this message because you are subscribed to the Google Groups
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.