Most apks have a /lib dir inside with .so files that can be several megabytes. Some even come loaded with libs for different architectures (arm, mips, x86). Libs for relevant arch are copied in /data/app-lib/[package name]
at install time, so they take double the space.
I tried to strip the apk from the /lib folder, rewrite, zipalign
and put back to install location /data/app
or /system/app
or /system/priv-app
to reclaim some space.
Tried with Chrome v78, it went from 45 mb apk to 15 mb...
Other apps too.
Everything seems to work.
Anyone thinks it's a bad idea? IMO the very Android system should perform this operation by default at install time...
edit 13 Nov
I wrote a script to automate the strip operation, just have to copy the apk to strip in a dir where this script resides, along with zip
and zipalign
binaries.
#!/system/bin/sh
for filename in `find . -name '*.apk'`
do
./zip -d $filename "lib/*"
./zipalign -fv 4 $filename $filename.new|tail
mv $filename.new $filename
chmod 644 $filename
done;
On my device I can swap original with stripped apks on the fly and they (usually) run fine without rebooting, even system apps.