[HTC Sensation] mudhi:
For optimizing apks, aside from fixAllAPKs by omniwolf, I found another one.

Note: I have no responsibility for breaking your ROM, so backup first.

Rights: No rights reserved, you can do whatever you like.

The classes.dex files have significant amount of debug infos in it, striping out those can reduce file size and increase some performance. I test it with all /system/app/ and /system/framework/ files, the ROM runs snapier, especially when you launching apps. Stripe out those debug info doesn't hurt anything, they are usefull only for original developer and one who wants to mod it, but you can always keep a copy of the original one for modding and debugging purpose.

Note that this does not boost performance like increase CPU freq, but the theory is, since the file size is reduced, dex and dalvik-cache became smaller in size, occupies memories smaller, thus processing is faster, and saves a little battery life, you can think it as something like optipng does.

Note also, you don't need to specify 0 compression, dex will be decompressed to /data/dalvik-cache, just use fixAllAPKs for fixing files inside APK that should not be compressed, and 0 compression for file type like xml isn't really a good idea.

Don't use this for ICS Framework files yet, there are specific files will causes surprising bugs when recompiled, but I'm lazy to find it out why and what, so just don't do it.

For FixAllAPKs, original thread here, http://xdaforums.com/showthread.php?t=1123463

or post #36 by carl1961 http://xdaforums.com/showpost.php?p=21458549&postcount=36

==========================================================================================================

RemoveDebuggingInfo_v2.2:

API Level must be specified to get 100% compatibility, it seems not forward nor backward compatible.

Froyo = 8, GB = 10, ICS4.0 ~ 4.0.2 = 14, ICS 4.0.3 = 15

Added API Level chooser, default 15 (ICS 4.0.3)

Added more descriptions.

Correct typos.

==========================================================================================================

depricated...

RemoveDebuggingInfo_v2.1:

First, Thanks to all who corrects me. :o

fix typo for menu selection 6

fix path for pulling for adb to work without setting PATH env variable

fix pushing framework to wrong directory :p

update smali/baksmali to v1.3.2

update script to compile/decompile using api level 15

added menu selection of fixAllAPKs

Instructions: Important

The default config is for ICS 4.03 base ROM, if you are gonna use it for Gingerbread Base ROM, need to edit the file RemoveDebuggingInfo.bat, and change the -a 15 to -a 10 for API level 10, then just double click start.bat and follow the on screen instruction.

Using API level 10 for ICS and API level 15 for GB will not work, you phone will just hang or endless reboots.

Pushing framework will reset all your settings, so if you choose to push framework, do a factory reset instead and just re-install your user apps.

After pushing /system/app, you must reboot to recovery and wipe dalvik and cache, another way of pushing is boot to recovery, mount /system then push.

I have only tested on Gingerbread 2.08.401.1 base, have no idea for ICS, but it should work, as the latest smali/baksmali supports ICS.

If you experience glitches, do it from the beginning by using un-modified apk and jar.

How it works: it is just baksmali (decompile dex to smali code WITHOUT debugging info) and then smali (compile back to dex)

Requirements: java and htc sync usb driver.

==========================================================================================================

Depricated - too much error.

RemoveDebuggingInfo_v2:

Added another script for simpler operations, instead of dragging hundreds of APKs, it is self descriptive, can pull and push /system/app, /system/framework, optimizing all files for app and framework, and reboot to recovery.

Tested on v2.08.401.1 ROM, on all files /system/app, /system/framework, should work on other device and ROM too, but not sure, test it yourself!

==========================================================================================================

For /data/app/ user application files, modify it may not installed at all, re-sign it also not help, so just do it manually to test.

But for now, here is a way to do it manually, since /system partition will not grow and many spaces left, you can simply put some APP on this partition, and following are working on my ROM, some should have naming as com.a.b.c... whatever is the name installed on /data/app/ stripe out the -1 at the end. Just besure the APP is uninstalled before pushing to /system/app/

Below are what I tested.

AdobePhotoshopExpress.apk

BarcodeScanner.apk

com.evernote.skitch.apk

ESFileExplorer.apk

GoogleDocs.apk

GoogleGoggles.apk

GoogleTranslate.apk

GPSTest.apk

org.hermit.audalyzer.apk

For APKs that has lib folder, you can just extract it and put it on /system/lib/ then del the lib folder inside the apk archive, e.g. flashplayer, adobereader.

adb should be start only once after booting your PC, if you get issues, like adb always shows restarting and out of date, it is because the included adb.exe in htc sync is out of date, and you had installed android sdk with environmental variable set, to fix it, both must have same version, or simply delete one of them, and if you have path variable set, you can del the included adb.exe as well.