As mentioned in Google Developers' article, it is now possible to recompress APK files using zopfli by running zipalign -z
. In my case, a 200 KB reduction is observed on a 5.1 MB APK file.
Normally I build the APK using a custom shell script, by running gradle assembleRelease
.
I want to run zipalign -z <the final apk>
after the above command. However, zipalign
is located in the build-tools/<build tools version>
directory, which I can't locate it except by pulling out the <build tools version>
from the build.gradle
file and constructing the path manually.
Is it possible to run zipalign
using the gradle
command that automatically run the zipalign
on the correct build-tools
directory without me having to reconstuct the path?
For example a command such as gradle runBuildTools zipalign -z $FINAL_APK $FINAL_APK.out