FORUMS

Analysis & Opinion

Top Forum Discussions

[APP] Zipalign binary and script - Optimize installed applications

382 posts
Thanks Meter: 32
 
Post Reply Subscribe to Thread Email Thread
Hey everyone,

Quote:
Originally Posted by wesgarner

Zip Align reduces the amount of RAM used during processing running for a major speed increase in running the apps: http://developer.android.com/guide/d.../zipalign.html

I had been messing about with a script to pull apks off my phone, zipalign them and then push them back, but then I saw wesgarner's CM build with a binary and script for use on your phone. I don't really want to mess round with flashing a ROM just for that though, so I've ripped them out and uploaded them below. Another reason is I want to run this manually (with GScript) rather than on boot (as it does in wesgarner's ROM).

I take no credit for this, the binary and script were both taken from wesgarner's CM buiild.

To "install" this, just adb push the two files in the zip below onto your phone with:

Code:
adb shell mount -o remount,rw /system
adb push zipalign /system/bin
adb push zipalign_apks /system/sd/zipalign_apks.sh
adb shell chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
adb shell mount -o remount,ro /system
Then anytime you want to run the script just do:
Code:
adb shell sh /system/sd/zipalign_apks.sh
Or in terminal:
Code:
su
sh /system/sd/zipalign_apks.sh
Has been tested on CM 4.2.7.1
Attached Files
File Type: zip zipalign.zip - [Click for QR Code] (11.6 KB, 6354 views)
Last edited by senab; 5th December 2009 at 01:36 PM.
The Following 3 Users Say Thank You to senab For This Useful Post: [ View ]
 
 
4th December 2009, 07:48 PM |#2  
LucidREM's Avatar
Senior Member
Flag Baltimore
Thanks Meter: 5
 
More
Exclamation ZipAlign
Quote:
Originally Posted by senab

Hey everyone,



I had been messing about with a script to pull apks off my phone, zipalign them and then push them back, but then I saw wesgarner's CM build with a binary and script for use on your phone. I don't really want to mess round with flashing a ROM just for that though, so I've ripped them out and uploaded them below. Another reason is I want to run this manually (with GScript) rather than on boot (as it does in wesgarner's ROM).

I take no credit for this, the binary and script were both taken from wesgarner's CM buiild.

To "install" this, just adb push the two files in the zip below onto your phone with:

Code:
adb shell mount -o remount,rw /system
adb push zipalign /system/bin
adb push zipalign_apks.sh /system/sd
adb shell chmod 755 /system/bin/zipalign /system/sd/zipalign_apks.sh
adb shell mount -o remount,ro /system
Then anytime you want to run the script just do:
Code:
adb shell /system/sd/zipalign_apks.sh
Or in terminal:
Code:
su
sh /system/sd/zipalign_apks.sh
Has been tested on CM 4.2.7.1

i do not even know what zipalign does .. but i did add this to my script

# lucid -z

so .. what does it do exactly?
4th December 2009, 08:02 PM |#3  
Vermithrax's Avatar
Senior Member
Flag Mobile, AL
Thanks Meter: 3
 
More
Sweet... Thanks...

I was surprised that more than half of the Apps I have were already ZipAligned...
4th December 2009, 08:10 PM |#4  
senab's Avatar
OP Senior Member
Flag London, UK
Thanks Meter: 32
 
Donate to Me
More
Quote:
Originally Posted by LucidREM

i do not even know what zipalign does .. but i did add this to my script

# lucid -z

so .. what does it do exactly?

APKs (as you probably already know) are just zip files. zipalign simply aligns the APK on 4-byte boundaries which Android is more efficient wrt memory access.

You can read more from Jean-Baptiste Queru at http://android-developers.blogspot.c...imization.html
Last edited by senab; 4th December 2009 at 08:16 PM.
4th December 2009, 08:14 PM |#5  
senab's Avatar
OP Senior Member
Flag London, UK
Thanks Meter: 32
 
Donate to Me
More
Quote:
Originally Posted by Vermithrax

Sweet... Thanks...

I was surprised that more than half of the Apps I have were already ZipAligned...

Since the 1.6 SDK was released, the ADT does this automatically on APK export. Therefore any app which has been updated since ~September (and was developed using the ADT Eclipse plugin) will be zipalign'd. I was more surprised that 12 out of the 43 apps on my phone weren't aligned!
4th December 2009, 08:15 PM |#6  
LucidREM's Avatar
Senior Member
Flag Baltimore
Thanks Meter: 5
 
More
Arrow ZipAlign
Quote:
Originally Posted by senab

APKs (as you probably already know) are just zip files. zipalign simply aligns the APK on 4-byte boundaries which Android is more much efficient wrt memory access.

You can read more from Jean-Baptiste Queru at http://android-developers.blogspot.c...imization.html

that's awesome .. thanks for the link .. i hadn't read about that
4th December 2009, 08:57 PM |#7  
overground's Avatar
Moderator & Developer Committee / Recognized Developer - xxxda-developers Founder
Flag Oxnard, CA Likes: Los Angeles Lakers Dislikes: Heavy petting zoos
Thanks Meter: 1,552
 
More
Thanks much for this!
Here is a simple gscript to install zipalign after a wipe or new build flash.
You must first create directory /sdcard/zipalign and place zipalign from the zip in the OP there. Path to the file should now be /sdcard/zipalign/zipalign.
Place this script in your gscript folder (after removing .txt from the name) and load it in gscript with su permissions.

I also find it easier to run the script in the zip from the OP in Gscript as well. Instead of placing it in /system/sd run this (assumes zipalign_apks.sh is at root of C:\)
Code:
adb remount
adb push C:\zipalign_apks.sh /sdcard/gscript/zipalign_apks.sh
Then just load it into Gsrcipt with su permissions as with the other script.

Easiest of all may just be to use the commands within Lucid's script. But, I'm comfortable with Gscript, and I can make it 2 clicks away.

EDIT: First execution, you may want to run the original way, because guess what? Gscript isn't zipaligned. But it worked fine just the same.
Attached Files
File Type: txt install_zipalign.sh.txt - [Click for QR Code] (143 Bytes, 580 views)
Last edited by overground; 4th December 2009 at 10:24 PM.
4th December 2009, 09:45 PM |#8  
deadite66's Avatar
Senior Member
Thanks Meter: 29
 
More
worked great thanks.
4th December 2009, 10:22 PM |#9  
g1DDriver's Avatar
Member
Thanks Meter: 4
 
More
Thanks. I didn't want to flash whole ROM to zipalign apps, so script was very handy.
Actually I've zipaligned only 2 apps, one of them was everybody loved Linda
5th December 2009, 12:56 AM |#10  
Senior Member
Brooklyn, NY
Thanks Meter: 38
 
More
so anyone wanna bless me with a terminal code to install the script?
5th December 2009, 01:19 AM |#11  
djluis48's Avatar
Senior Member
Flag Santo Domingo
Thanks Meter: 232
 
More
Quote:
Originally Posted by garz

so anyone wanna bless me with a terminal code to install the script?

Read, its on the first post....xD

Read More
Post Reply Subscribe to Thread

Tags
1.21 gigawatts!
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes