Last active
June 14, 2017 04:46
-
-
Save eefret/dc0efe4b4b9c964a6c17c91ce716432e to your computer and use it in GitHub Desktop.
Opens & Highlights the apk in explorer/finder after a release build.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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