androidzipalign

Does zipalign execute automatically when a .apk is generated as signed from Android Studio?


I am wondering if the method of generating a signed .apk for release , also zipaligns the apk . In the directions of the android page (http://developer.android.com/tools/publishing/app-signing.html#studio) , it is not clear if zipalign is a different step.

thank you!


Solution

  • You can define build types in the build.gradle file.

    buildTypes {
    
         debug {
            storeFile file("debug.keystore")
         }
    
         release {
            zipAlignEnabled true
         }
    }
    

    The debug config is used when you are debugging your apk and the release config when you're creating a release apk.

    If you set zipAlignEnabled true in case of release, the apk will be zipaligned. If you do not specify it, the default value is true in case of release and the apk will be zipaligned automatically. For debug, the default value is false.

    Read more about build types and other possible properties you can set here : http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types