You can use the following ant task to repack apk:
<target name="-post-package"> <exec executable="${z7zip}"> <arg value="x"/> <arg value="-o${out.dir}/TempApk"/> <arg value="${out.packaged.file}"/> </exec> <delete file="${out.packaged.file}" verbose="${verbose}"/> <exec executable="${z7zip}" dir="${out.dir}/TempApk"> <arg value="a"/> <arg value="-tzip"/> <arg value="-mx9"/> <arg value="-r"/> <arg value="${out.packaged.file}"/> <arg value="*.*"/> </exec> <delete dir="${out.dir}/TempApk" verbose="${verbose}" />
It uses 7zip. The path to 7zip should be in local.properties:
z7zip=C:\\Program Files\\7-Zip\\7z.exe
This gives about 15% better compression. Of course, you can use any other tool or just execute these command lines manually to repack your apk.
source share