Created
August 22, 2016 10:54
-
-
Save sewerk/e06a2cd90a49ec3179ecd8374302945d to your computer and use it in GitHub Desktop.
This file contains 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
// reveal apk file in folder after release generated | |
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 = output.outputFile | |
} | |
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() | |
} | |
} | |
} | |
} | |
} | |
// delete unaligned files | |
android.applicationVariants.all { variant -> | |
variant.assemble.doLast { | |
variant.outputs.each { output -> | |
println "aligned " + output.outputFile | |
println "unaligned " + output.packageApplication.outputFile | |
File unaligned = output.packageApplication.outputFile; | |
File aligned = output.outputFile | |
if (!unaligned.getName().equalsIgnoreCase(aligned.getName())) { | |
println "deleting " + unaligned.getName() | |
unaligned.delete() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment