I have setup a Jenkins that automatically uploads nightly APKs to the Play Store. Starting some days ago, the upload to the Play always failed with this: Upload failed: APK is not zip aligned.
So I investigated a bit found that one of the changes that I did the days these issues started was to update the Gradle plugin to 2.2.0-alpha3. Doing a quick Google search showed that everybody is having this issue.
Gradle plugin 2.2.0-alpha3 is somehow missing the zipalign task and will create APKs that are NOT zip aligned! I also tested to manually sign the APK afterwards, which also fails…
So for now, the only solution would be to revert back to 2.2.0-alpha2 of the Gradle plugin. Which also forces you to revert back to Android Studio 2.2 Preview 2 since Preview 3 will not compile your project when you don’t use plugin version 2.2.0-alpha3… But how do we do that?
Yeah, you have to do a fresh installation of Android Studio 2.2 Preview 2 and perform the updates until you are at Preview 2 and then stop, don’t install the Preview 3 update and wait for Preview 4.