Quick explanation of Zipalign?

Discussion in 'Liquid' started by bigeric828, Mar 12, 2011.

  1. bigeric828

    bigeric828 Member

    Joined:
    Mar 8, 2011
    Messages:
    509
    Likes Received:
    1
    Trophy Points:
    18
    Ratings:
    +1
    Could someone quickly explain what this is/does and how to effectively use it? I'm new to Liquid. Thanks in advance.
     
  2. jdm627

    jdm627 Member

    Joined:
    Jul 4, 2010
    Messages:
    474
    Likes Received:
    0
    Trophy Points:
    16
    Ratings:
    +0
    zipalign | Android Developers
     
  3. thaDroidz

    thaDroidz Silver Member

    Joined:
    Aug 31, 2010
    Messages:
    2,058
    Likes Received:
    42
    Trophy Points:
    113
    Location:
    neptune
    Ratings:
    +42
    that links is in chinese or some other foreign language... :)
     
  4. CJM

    CJM Super Moderator
    Staff Member Rescue Squad Premium Member

    Joined:
    Sep 12, 2010
    Messages:
    10,593
    Likes Received:
    1,668
    Trophy Points:
    558
    Location:
    Mississippi Gulf Coast
    Ratings:
    +1,810
    Current Phone Model:
    Nexus 6
    Twitter:
    https://twitter.com/Corey
    Hows this:

    "zipalign is an archive alignment tool that provides important optimization to Android application (.apk) files. The purpose is to ensure that all uncompressed data starts with a particular alignment relative to the start of the file. Specifically, it causes all uncompressed data within the .apk, such as images or raw files, to be aligned on 4-byte boundaries. This allows all portions to be accessed directly with mmap() even if they contain binary data with alignment restrictions. The benefit is a reduction in the amount of RAM consumed when running the application.

    This tool should always be used to align your .apk file before distributing it to end-users. The Android build tools can handle this for you. When using Eclipse with the ADT plugin, the Export Wizard will automatically zipalign your .apk after it signs it with your private key. The build scripts used when compiling your application with Ant will also zipalign your .apk, as long as you have provided the path to your keystore and the key alias in your project build.properties file, so that the build tools can sign the package first.

    Caution: zipalign must only be performed after the .apk file has been signed with your private key. If you perform zipalign before signing, then the signing procedure will undo the alignment. Also, do not make alterations to the aligned package. Alterations to the archive, such as renaming or deleting entries, will potentially disrupt the alignment of the modified entry and all later entries. And any files added to an "aligned" archive will not be aligned.

    The adjustment is made by altering the size of the "extra" field in the zip Local File Header sections. Existing data in the "extra" fields may be altered by this process."
     
  5. WugFresh

    WugFresh Developer
    Developer

    Joined:
    Oct 4, 2010
    Messages:
    587
    Likes Received:
    1
    Trophy Points:
    16
    Ratings:
    +1
    Heres an oversimplified explanation of optimized file structures on android:
    Optimized File Structures

    Maybe that would help...

    {{ WugFresh }}
     
  6. thaDroidz

    thaDroidz Silver Member

    Joined:
    Aug 31, 2010
    Messages:
    2,058
    Likes Received:
    42
    Trophy Points:
    113
    Location:
    neptune
    Ratings:
    +42
    Ha.. simple that one just may help...


    lmfao...
     
    #6 thaDroidz, Mar 12, 2011
    Last edited: Mar 12, 2011
  7. bigeric828

    bigeric828 Member

    Joined:
    Mar 8, 2011
    Messages:
    509
    Likes Received:
    1
    Trophy Points:
    18
    Ratings:
    +1
    So with that said, WHEN should i actually run the command?
     
  8. Jaxidian

    Jaxidian Team FreeMyMoto
    Premium Member Developer

    Joined:
    Jun 26, 2010
    Messages:
    554
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Indianapolis
    Ratings:
    +0
    As the absolute last thing before you distribute your apk.

    Sent from my NookColor using Tapatalk
     
  9. liquid0624

    liquid0624 Premium Member
    Premium Member Developer

    Joined:
    Mar 24, 2010
    Messages:
    584
    Likes Received:
    5
    Trophy Points:
    18
    Ratings:
    +5
    Zipalign just optimizes the apks for the android platform; byte by byte
     
  10. thaDroidz

    thaDroidz Silver Member

    Joined:
    Aug 31, 2010
    Messages:
    2,058
    Likes Received:
    42
    Trophy Points:
    113
    Location:
    neptune
    Ratings:
    +42
    I think what bigeric828 is asking,
    should we (users of LGB not app dev's) use the zipalign script via Liq Setting -> system? And what can/should we look for as a benifit if so?

    Those definition links seem as this is a process for app developers not really average users... dunno...
     
Search tags for this page
android zipalign on boot
,

auto zipalign

,
auto zipaligned
,
benefits of zipalign
,
this allows all portions to be accessed directly with mmap()
,
what does zip align apks do?
,
zip align apps on phone
,
zip align on boot
,
zipalign -c -v existing.apk
,
zipalign explanation