Skip to content

Instantly share code, notes, and snippets.

@eefret
Last active June 14, 2017 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eefret/dc0efe4b4b9c964a6c17c91ce716432e to your computer and use it in GitHub Desktop.
Save eefret/dc0efe4b4b9c964a6c17c91ce716432e to your computer and use it in GitHub Desktop.
Opens & Highlights the apk in explorer/finder after a release build.
applicationVariants.all { variant ->
variant.assemble.doLast {
//If this is a 'release' build, reveal the compiled apk in finder/explorer
if (variant.buildType.name.contains('release')) {
def path = null
variant.outputs.each { output ->
path = "${rootDir}/${project.name}/build/outputs/apk/release/${output.outputFileName}"
}
task openReleaseFile(type: Exec) {
if (System.properties['os.name'].toLowerCase().contains('mac os x')) {
['open', '-R', path].execute()
} else if (System.properties['os.name'].toLowerCase().contains('windows')) {
['explorer', '/select,', path].execute()
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment