Page 1 of 7 123 ... LastLast
Results 1 to 10 of 61

Thread: Optimized Software

777
  1. [translate]    #1
    Member
    Join Date
    Jun 2010
    Location
    Slovenia
    Posts
    81

    Lightbulb Optimized Software

    Applications often contain huge overhead in their APK files, mostly in drawable-hdpi folders (for devices with higher resolutions). We should try to build optimized versions of the applications for our Spicas. So open your APKs, remove unnecessary files, and post the links so that we can reduce storage use and loading times.



    The list will be updated as new optimized applications are added. PM me for more info. Files can be downloaded from your phone as well: www.zadet.net/files/

    _____________________________

    There are two basic ideas of making your applications smaller:

    1.) Removing files directly from APK - This method is usually enough for graphically intensive applications (weather widgets, ...)

    • Make a backup copy of the APK
    • Rename .APK to .ZIP if you need to
    • Open the file with the ZIP utility (7-Zip, WinRAR, Total Commander)
    • Get familiar with the folders inside the APK
    • Most files will reside in /res/ subfolders. There are usually PNG and XML files.
    • The ones that might be useless are usually in "drawable-hdpi" and "drawable-ldpi" folders. Because Spica has a 320x480 screen (referred to as "mdpi" or medium density), but other phones have lower or (usually) higher densities, you can often delete the files intended for other screens without corrupting the application.
    • If there is a folder such as "drawable-mdpi" or "drawable", the files for Spica are probably there...
    • ...unless the number of files in "drawable-hdpi" folder is larger than the number of files in "drawable(-mdpi)". This means the application was mainly developed for larger screens and the main files might be in -hdpi, and then either replaced by -mdpi versions or scaled down from -hdpi images.
    • You usually cannot replace PNG files directly (for example with an optimized image). This is because every file has a special signature (in /META-INF/ folder), and any modification of the file will change it's signature, and the APK won't install. If you wish to replace files, you have to use the second method.
    • Install the modified APK and test it.


    2.) Decoding and rebuilding the APK using apktool - This method gives best results, includes the first method, but there is also more chance something will go wrong (application FC).
    • Make a backup copy of the .APK
    • You must have Java installed, as well as apktool (or APK manager)
    • Decode you APK (apktool d someapp.apk)
    • The folder "someapp" will be created, containing the files from the APK as well as many others (mostly XMLs)
    • You can now modify the files inside the /res/ subfolders.
    • The PNG files usually cannot be deleted. They are referenced by .XML files, and if they are missing, the apktool cannot build the APK and will quit.
    • You can often delete some of the XML files directly. Usually those files are in "raw-*", "layout-*" subfolders and contain localizes strings (other languages). They may be successfully removed because the main strings (english) are in the "layout" folder. Do not remove the "layout-land" and "layout-port" XMLs because those are needed for landscape/portrait orientation of the application.
    • Build the APK (apktool b someapp someapp.apk). You should probably try this after every (major) change. If the build doesn't succeed retrace your modifications until it does. *
    • New finding: some APK files contain folders other than "/res" (and "/META-INF"). These folders have to be copied from the original APK into the new APK at this point, before testsigning the APK.
    • Test sign it (java -classpath testsign.jar testsign someapp.apk) *
    • ZIP align it (zipalign 4 someapp-temp.apk someapp.apk) *
    • NOW you can delete the unwanted files (first method)
    • If you have an original version of the application installed, remove it first. The modified version will not install because it has a different certificate (testsigned).
    • Install the modified APK and test it.

    * These steps can be automated by using "build.bat" from this script (see readme.txt inside the ZIP)


    Feel free to experiment, there's not much you can screw up, apart from the application not installing or running. But you made a backup, right?
    The tutorial will be updated based on addition questions/remarks below.
    Last edited by Zadet; 02-17-2011 at 09:11 AM. Reason: Added iGO optimization

  2. [translate]    #2
    Moderator
    Join Date
    May 2010
    Location
    h3LL
    Posts
    3,492

    Default

    would be great if you can post a tutorial on how to optimize apps, is it by simply deleting hdpi folders from the apk?
    d0n't drink and driv3, y0u might hit a bump and dr0p y0ur b33r .. Ch33rs
    Samsung Spica (CM7) | Nexus One (CM7) | Galaxy Nexus (AOKP) | PS3 Slim (Rebug 3.55)

  3. [translate]    #3
    Senior Member
    Join Date
    Jul 2010
    Location
    Poland, Gdańsk, Tczew
    Posts
    162

    Default

    I think APK Menager can do this... Am I wrong?

  4. [translate]    #4
    Senior Member
    Join Date
    Jul 2010
    Location
    England
    Posts
    599

    Default

    Quote Originally Posted by Zadet View Post
    Applications often contain huge overhead in their APK files, mostly in drawable-hdpi folders (for devices with higher resolutions). We should try to build optimized versions of the applications for our Spicas. So open your APKs, remove unnecessary files, and post the links so that we can reduce storage use and loading times.



    The list will be updated as new optimized applications are added. PM me for more info.
    Great
    Will these work on CM 6.3?
    ZTE Blade - CyanogenMod 7 Nightlies - Gen 2
    Android 2.3.7
    Samsung Galaxy Spica - CyanogenMod 7 - Retired
    Android 2.3.7

  5. [translate]    #5
    Member
    Join Date
    Jun 2010
    Location
    Slovenia
    Posts
    81

    Default

    Unfortunately I have no option to test it on CM. Apart from the theme, none of the APKs have been decompiled/rebuilt, so they should probably work. I'll update the first post with more info (on which system it's been confirmed to run OK, how to optimize the apps).

  6. [translate]    #6
    Senior Member
    Join Date
    May 2010
    Location
    india
    Posts
    547
    <!-- Start of adf.ly banner code -->
    <div style="width:468px; text-align:center;font-family:verdana;font-size:10px;">
    <a href="http://adf.ly/?id=449217"><img border=0 src="http://adf.ly/images/banners/adfly.468x60.4.gif" width="468" height="60" alt="adf.ly - shorten links and earn money!"></a>
    <br /><a href="http://adf.ly/?id=449217">Get paid to share your links!</a>
    </div>
    <!-- End of adf.ly banner code -->

  7. [translate]    #7
    Senior Member
    Join Date
    Aug 2010
    Location
    India
    Posts
    121

    Default

    good idea, as munchy said please post a tutorial............

  8. [translate]    #8
    Member
    Join Date
    Jun 2010
    Location
    Slovenia
    Posts
    81

    Default

    Quote Originally Posted by drummer1 View Post
    I think APK Menager can do this... Am I wrong?
    APK manager automates some steps of the second method in my tutorial. It certainly cannot remove any files. The only optimization can do is on PNG files, but they are usually optimized already. I'll prepare my version of scripts for automating the process a little bit.

  9. [translate]    #9
    Member
    Join Date
    Aug 2010
    Location
    Ph
    Posts
    33

    Default

    Zadet.... i've been optimizing some Apk's... and re-signing it with 'Auto-Sign' successfully!

    however...recently for some reason i'm not aware of.....
    i've encountered some apk's that give me 'cannot be installed message after editing and
    re-signing it... do you know any work around with this?


    ----SOLVED.. got it!
    Last edited by goodspeed; 10-14-2010 at 01:17 PM.

  10. [translate]    #10
    Member
    Join Date
    Jun 2010
    Location
    Slovenia
    Posts
    81

    Default

    It greatly depends on what APK you were optimizing.
    If it's framework-res.apk then you need to be careful not to compress resources.arsc (unzip from APK, add back to APK using "store only" or "zero compression").
    If it's some other application, then there might be a problem with the original application using a different certificate as your modded one (testsigned). Try removing the application first.

    Edit: since themes cannot be "installed", the first suggestion is obviously irrelevant.

Page 1 of 7 123 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •