Skip to content

Instantly share code, notes, and snippets.

import com.android.builder.testing.ConnectedDeviceProvider
def DEVICES_PROPERTY = "devices"
ConnectedDeviceProvider.metaClass.getProperty = { String name ->
def metaProperty = delegate.metaClass.getMetaProperty(name)
def property = metaProperty.getProperty(delegate)
if (name.equals(DEVICES_PROPERTY) && project.hasProperty(DEVICES_PROPERTY)) {
def devicesSerials = project.getProperties().get(DEVICES_PROPERTY).split(/,/)
def devices = property.findAll {devicesSerials.contains(it.serialNumber)}
property = devices
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "test.co.vv.myapplication"
minSdkVersion 15
targetSdkVersion 21