[Tool][Win] GOptimize v1.44 (BASH script for CYGWIN)

methuselah

Senior Member
Aug 25, 2011
3,804
2,119
253
Lol .....my fault ...when i saw something like that i just ran out to see it for android ...

Sent from my HTC Wildfire using xda app-developers app
 

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
After some testing, same APK's with compressed resources.arsc use more ram for about the size of resources.arsc
My guess is that probably asset manager needs to decompress resources.arsc in ram...

So system apk's and apps like FaceBook, Viber, Whatsapp & Widgets should always have resources.arsc uncompressed as they are always running in background when you're doing nothing with phone...
 

vishal_android freak

Inactive Recognized Developer / Recognized Contrib
Dec 30, 2012
1,898
5,637
0
Mumbai
After some testing, same APK's with compressed resources.arsc use more ram for about the size of resources.arsc
My guess is that probably asset manager needs to decompress resources.arsc in ram...

So system apk's and apps like FaceBook, Viber, Whatsapp & Widgets should always have resources.arsc uncompressed as they are always running in background when you're doing nothing with phone...
As far as I know, they run in background because its an instant messaging app and if its not continuously running, we won't receive messages as soon as they are sent to us.. Right?:confused:

Sent from my Xperia Neo V using xda premium
 

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
As far as I know, they run in background because its an instant messaging app and if its not continuously running, we won't receive messages as soon as they are sent to us.. Right?:confused:

Sent from my Xperia Neo V using xda premium
Yes...

Only apps that truly use Google Push Message system are IM+ and Tapatalk 4. They don't consume memory while they are in background...

It's main reason for me why I prefer IM+ over imo... imo uses 10MB of ram constantly even if you don't use it... IM+ uses <1MB while in background...
 

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
UPDATE 2013-09-13 v1.21
  • Further improved MT PNG optimization
  • Added -s2 option so you can try removing debugging info using smali/baksmali v2 beta if default v1.4.2 fails
  • ReWorked compression levels; Read Extra Help; -he or -hh option
  • Updated TruePNG to 0.4.0.8
  • Updated CygWin Tools
  • Lots of "can't remember right now" minor fixes

Next to do thing is probably APK ReSigning so you don't need to have ROM patched or ReSign APK's for installing normal apps.
But I find it easier to patch ROM using Lucky Patcher not to check signatures...
 

lolet

Senior Member
Feb 26, 2011
54
37
0
UPDATE 2013-09-13 v1.21
  • Further improved MT PNG optimization
  • Added -s2 option so you can try removing debugging info using smali/baksmali v2 beta if default v1.4.2 fails
  • ReWorked compression levels; Read Extra Help; -he or -hh option
  • Updated TruePNG to 0.4.0.8
  • Updated CygWin Tools
  • Lots of "can't remember right now" minor fixes

Next to do thing is probably APK ReSigning so you don't need to have ROM patched or ReSign APK's for installing normal apps.
But I find it easier to patch ROM using Lucky Patcher not to check signatures...
Hey, great tool. Could you add a feature to keep resources for single dpi? eg. if framework-res.apk contains wallpapers for ldpi, hdpi, etc. it'd keep only hdpi, but if ldpi contains file which doesn't have hdpi it will keep it as well.
 

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
Hey, great tool. Could you add a feature to keep resources for single dpi? eg. if framework-res.apk contains wallpapers for ldpi, hdpi, etc. it'd keep only hdpi, but if ldpi contains file which doesn't have hdpi it will keep it as well.
Don't have time right now but I will give it a try next month.
There are so many drawable folders so it will be complicated...
 
  • Like
Reactions: ct_moi

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
Changelog:

2013-09-22 v1.22
  • Added -t option to sign apk with Android test certificate so you can install goptimized apk's (Java configuration required)
 
  • Like
Reactions: Madaditya

akuila

Senior Member
Oct 28, 2011
86
8
0
Pekanbaru
bukan-anak.tk
i don't really understand about this stuff yet i wanna try it,
is this : -m8 -zb -a0 -d5 -b15 -k1 -l5 -r5 *.apk; good enough to get both optimized png and compressed for system and non system apk ?
 
Last edited:

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
i don't really understand about this stuff yet i wanna try it,
is this : -m8 -zb -a0 -d5 -b15 -k1 -l5 -r5 *.apk; good enough to get both optimized png and compressed for system and non system apk ?
Yes...
-b15 is removing debugging info for ICS
-k1 will remove all libs except for armeabi (check that you don't need armeabi-v7a)

For non system apps you need to use -t option or patch rom with Lucky Patcher not to verify signatures...
 
  • Like
Reactions: akuila

akuila

Senior Member
Oct 28, 2011
86
8
0
Pekanbaru
bukan-anak.tk
Yes...
-b15 is removing debugging info for ICS
-k1 will remove all libs except for armeabi (check that you don't need armeabi-v7a)

For non system apps you need to use -t option or patch rom with Lucky Patcher not to verify signatures...
then how about CM 10.1 ?
apparently, i'm using it on cm 10.1, looks like it doesn't reduce the size pretty well, i mean, the size reduced was small compared to apk multi tool with optimized png + zipalign.

right now my free space on system is 26 MB with 73 apk files, i can't odex all of them, need more compression, could you give me a suggestion?

over all, i'm satisfied enough with this tools :victory:, its was easy to use and with only 1 click :p, do all the job while i'm enjoying a cup of tea
 

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
then how about CM 10.1 ?
apparently, i'm using it on cm 10.1, looks like it doesn't reduce the size pretty well, i mean, the size reduced was small compared to apk multi tool with optimized png + zipalign.

right now my free space on system is 26 MB with 73 apk files, i can't odex all of them, need more compression, could you give me a suggestion?

over all, i'm satisfied enough with this tools :victory:, its was easy to use and with only 1 click :p, do all the job while i'm enjoying a cup of tea
My script optimizes png's better but multi-apktool compresses resources.arsc which results smaller files but more ram usage because android asset manager needs to decompress resources.arsc before accessing it (which it doesn't when it's uncompressed)

you can try -a1 option to light compress resources.arsc (instead -a0)

all Google Play apps have resources.arsc uncompressed except FaceBook because it's 7MB (2MB compressed)
and when I uncompress resources.arsc FB starts faster....
 
  • Like
Reactions: akuila

akuila

Senior Member
Oct 28, 2011
86
8
0
Pekanbaru
bukan-anak.tk
My script optimizes png's better but multi-apktool compresses resources.arsc which results smaller files but more ram usage because android asset manager needs to decompress resources.arsc before accessing it (which it doesn't when it's uncompressed)

you can try -a1 option to light compress resources.arsc (instead -a0)

all Google Play apps have resources.arsc uncompressed except FaceBook because it's 7MB (2MB compressed)
and when I uncompress resources.arsc FB starts faster....
hmm it's true, i feel this more faster than i do optimizing and compress with apk multi tool
well, i still can use the phone without odexing them
and i already use a2sd

thank you for your advice.
 

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
hmm it's true, i feel this more faster than i do optimizing and compress with apk multi tool
well, i still can use the phone without odexing them
and i already use a2sd

thank you for your advice.
NP

I also started with using APK Multi Tool but I didn't liked the way it worked. Even when author added option to choose separate compression level for resources.arsc it didn't worked, so I started creating my own script to un-compress resources.arsc. Then, I've done a little research and found a way to optimize PNG's better and reduce it's size even more and stopped using AMT. (Best test between optimizing in my script and in apk multi tool is to check uncompressed sizes; info button in winrar, total size row; info button in 7-zip, size row)

AMT is good tool for modding apps, but its limitation is that it uses Windows Batch for scripting which is very limited.
It could do much more in BASH scripting.
 

hertzschi

Senior Member
May 23, 2012
503
273
93
Nice Tool :good:
I achieved compression of my themes of -20% :D

Just one question:

If I GOptimized my theme/app and then later decompile, modify and compile again: do I have to GOptimize it again?

Thanks
 

algarues

Senior Member
Feb 14, 2011
251
25
48
Sorry for the silly question

but before using the script I read the thread, and wonder myself (after the discussion on the .jar files)

If I have to use the script on deodexed apps only or I can use it on the apk portion of the app when it is odexed?

Thanks a lot for the info
 

gu5t3r

Senior Member
May 30, 2012
1,610
1,516
0
Sorry for the silly question

but before using the script I read the thread, and wonder myself (after the discussion on the .jar files)

If I have to use the script on deodexed apps only or I can use it on the apk portion of the app when it is odexed?

Thanks a lot for the info
You can... but you can't remove debug info from odexed jar because there is no dex file in it...
 
Last edited: