I trying to start application via gradle
task
.
task runDebug(dependsOn: [\'installDebug\', \'run\']) {
}
task run(type: Exec) {
comm
The problem was solved.
The variable must contain
def adb = "$System.env.ANDROID_HOME/platform-tools/adb"
And complete task looks like
task run(type: Exec) {
def adb = "$System.env.ANDROID_HOME/platform-tools/adb"
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.example.myexample/.ui.SplashScreenActivity'
}
UPD
Another way without using ANDROID_HOME
task run(type: Exec) {
def rootDir = project.rootDir
def localProperties = new File(rootDir, "local.properties")
if (localProperties.exists()) {
Properties properties = new Properties()
localProperties.withInputStream {
instr -> properties.load(instr)
}
def sdkDir = properties.getProperty('sdk.dir')
def adb = "$sdkDir/platform-tools/adb"
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.example.myexample/.ui.SplashScreenActivity'
}
}