Skip to content

Instantly share code, notes, and snippets.

@android10
Last active August 29, 2023 14:31
Show Gist options
  • Save android10/0b291129b4aec15b262d603612499e37 to your computer and use it in GitHub Desktop.
Save android10/0b291129b4aec15b262d603612499e37 to your computer and use it in GitHub Desktop.
Compile and launch android app from the command line.
task deployDebug(type: Exec, dependsOn: 'app:installDebug') {
def rootDir = project.rootDir
def localProperties = new File(rootDir, "local.properties")
if (localProperties.exists()) {
Properties properties = new Properties()
localProperties.withInputStream {
inputStream -> properties.load(inputStream)
}
def sdkDir = properties.getProperty('sdk.dir')
def adb = "$sdkDir/platform-tools/adb"
commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.package/com.package.YourMainActivity'
}
}
@cescoferraro
Copy link

@jlobos thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment