Gradle 2.14
android {
dev {
}
}
task runAppDev(type: Exec, dependsOn: 'installDev') {
description "Install and run app (dev env)"
android.applicationVariants.all { variant ->
if ("installDev".toUpperCase().endsWith(variant.getName().toUpperCase())) {
commandLine getRunAppCommandLine(variant)
}
}
}
def getRunAppCommandLine(variant) {
List<String> commandLine = ["adb", "shell", "am", "start", "-n", variant.getApplicationId() + "/.activity.SplashActivity"]
return commandLine
}
Run my task by: gradlew runAppDev
Result:
Installing APK ‘app-dev.apk’ on ‘Nexus 5 - 6.0.1’ for app:dev Installed on 1 device. :app:runAppDev BUILD SUCCESSFUL
So, my application success installed on device, but NOT run on device.