Skip to content

Instantly share code, notes, and snippets.

@stefanhoth
Last active August 29, 2015 14:21
Show Gist options
  • Save stefanhoth/ca234ed53386a9ff114d to your computer and use it in GitHub Desktop.
Save stefanhoth/ca234ed53386a9ff114d to your computer and use it in GitHub Desktop.
Allow gradle to only use devices that meet your criteria
android {
...
deviceProvider new AwesomeDeviceProvider(getAdbExe())
}
class AwesomeDeviceProvider extends com.android.builder.testing.ConnectedDeviceProvider {
AwesomeDeviceProvider(File adbLocation) {
super(adbLocation)
}
public String getName() {
return "awesome"
}
public List<? extends com.android.builder.testing.api.DeviceConnector> getDevices() {
List localDevices = super.getDevices()
localDevices.grep {
it.getApiLevel() > 16 &&
it.iDevice.getProperty("ro.product.manufacturer") == 'Genymotion'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment