Making My Android Apps Zipaligned

android-photics-forums-thumbnailWhen I would publish my Android Apps, the Google Developer Console would give me an unusual error. “The apk is not zipaligned. Please run the…” Blah, blah, blah… what’s Google complaining about now? Typically, I would just ignore this warning. Why should I care? Google didn’t prevent my app from being published, so I would just let it go. But recently, I decided to give this another look. How do I zipalign my apps? I went digging through the Android Developer documents and I was finally able to publish my apps properly. Although, as usual, it was a bit of a struggle. That’s because I hadn’t updated my Android software in a while. It seems that some things have changed in Android land.

My first reaction was to go to the Android website. Surely, they must have information about this matter. With a unique term like “zipaligned” it wasn’t too hard to find the correct document. What surprised me was the following statement, “When using Eclipse with the ADT plugin, the Export Wizard will automatically zipalign your .apk after it signs it with your private key.” I was using Eclipse with the Android Development Tools plugin, but my apps were not being aligned.

If your Android Apps are not aligned, the Google console should give you a warning.
If your Android Apps are not aligned, the Google console should give you a warning.

I figured that it was probably a software issue. I needed to upgrade. First, I upgraded my software through Eclipse.

  • Eclipse: Help > Software Updates > Update

This was a feeble attempt to resolve the problem. I received the following error…

The zipalign tool was not found in the SDK.

Please update to the latest SDK and re-export your application or run zipalign manually.

Alligning applications allows Android to use application resources more efficiently

I checked for updates again, but the software stated that, “There is nothing to update.” I knew that I had to reinstall the Android SDK. It’s not so much that I forgot about this step. It was more like blocking out a painful memory. I usually run into problems when I try to install / re-install the Android SDK. This time was no different.

I attempted to update my “android” folder with the new files. When I relaunched Eclipse, all of my apps were highlighted with red marks. I tried launching the SDK Setup.exe application file, but that did nothing. I received yet another error.

Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml, reason: HTTPS SSL error. You might want to force download through HTTP in the settings.

Oh right, I had forgotten about that stupid problem. I went to the settings and changed the download from https to http. That’s when things started working normally… perhaps better than before. The upgrade contained a new interface for the emulator. It’s a little gray, but I like it. The layout is much cleaner and it’s easier to keep on the screen. There’s probably a bunch of other stuff to learn, but I was focused on resolving the zipalign issue.

The updated Android Emulator has a cleaner interface.
The updated Android Emulator has a cleaner interface.

I’m not sure how much of an improvement my apps will see from zipalignment, but I decided to stop ignoring the warning. I try to do my best. Knowing that zipalignment is supposed to save on RAM, I figured that I should try to learn how to do it. I’m glad that I went through the trouble to resolve this problem. Zipalignment doesn’t just benefit one app, it is a technique that I can use to improve all of my apps. All I had to do was properly upgrade my software.

2 thoughts on “Making My Android Apps Zipaligned”

  1. It seems that all I had to do was update my software. Once I was done updating Eclipse and the Android SDK, all I had to do was export my app. The Eclipse / Android SDK software combo seems to automatically zip aligned my .apk files for me now.

    In the Eclipse Package Explorer tab, I right clicked my app folder. A menu popped up, I clicked “Android Tools” and then “Export Signed Application Package” to create the file for Google. I already had a keystore file set up, so it was just a matter of entering the information into the screens that followed. I like this way a lot more than the way I was doing it before.

Leave a Reply