android - APK compression level, size reduction -
since apk file zip file different extension , few meta parameters, seems there way change compression level of file.
just verify eclipse isn't exporting highest compression level, i've tried pack contents of apk on own compression level set via winrar, , got reduction of 20% which
1 mb.
i couldn't find easy way repack apk safely without deleting metadata. i've tried 7zip , aapt, apktool.
you can use following ant task 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. path 7zip should in local.properties:
z7zip=c:\\program files\\7-zip\\7z.exe
it gives 15% better compression. of course can use other tool or execute these command lines manually repack apk.
Comments
Post a Comment