As mentioned in the Google Developers article , you can now recompile the APK files using zopfli by running zipalign -z. In my case, a decrease of 200 KB is observed in the 5.1 MB APK file.
I usually create an APK using a special shell script by running gradle assembleRelease.
I want to run zipalign -z <the final apk>after the above command. However, it zipalignis in a directory build-tools/<build tools version>that I can not find, except to extract <build tools version>from the file build.gradleand construct the path manually.
Is it possible to start zipalignusing a command gradlethat automatically starts zipalignin the correct directory build-toolswithout having to restore the path?
For example, a command such as gradle runBuildTools zipalign -z $FINAL_APK $FINAL_APK.out
source
share