Android Studio is not generating zip aligned apk-ThrowExceptions

Exception or error:

I am using Android Studio 1.2.2

My sdk is well updated and build-tools version installed is 22.0.1

Build > Generate Signed Apk

I only get app-release-unaligned.apk in (app/build/outputs/apk/)

I have already googled and tried:

  1. Copy Pasting “zipalign.exe” from build-tools folder to : (i) sdk/tools/ (ii) sdk/platform-tools/

  2. Adding “zipAlignEnabled true” under buildTypes in build.gradle

  3. Gradle zipAlign task not working?

Please help solve this issue, I want to zipalign using Android Studio.

This is my first app i am trying to publish !!!

How to solve:

It is pretty easy to generate the signed apk file with Android Studio.

Here are the steps:

enter image description here

enter image description here

enter image description here

###

You probably are generating it, but the release .apk file is placed in a different directory from the other .apk files.

On my system, for an app called TheApp, .apk files are usually placed in the build/outputs/apk directory:

TheApp/build/outputs/apk/TheApp-debug.apk
TheApp/build/outputs/apk/TheApp-debug-unaligned.apk
TheApp/build/outputs/apk/TheApp-release-unaligned.apk

but the aligned release .apk file is placed directly in the app’s root directory :

TheApp/TheApp-release.apk

(This was already answered by @yushulx but I hope this shorter answer is clearer).

Leave a Reply

Your email address will not be published. Required fields are marked *