Question

I have just finished and signed the apk through android studio, then I have did an apk protect through apkprotect.com when I am trying to upload the apk to play store I got this error " You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again. " if I upload the original apk I got no errors,

I have tried to add zipalign true in the build.gradle but nothing happened I have tried also disable and enable proguard .

Was it helpful?

Solution

You can run zipalign manually in command line:

zipalign [-f] [-v] <alignment> infile.apk outfile.apk

Note that zipalign is located inside ${sdk.dir}\tools

For more details visit zipalign


[Update]

Also, If you need to sign it you can run:

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore YOURKEYSTORE unsigned.apk alias_name

(jarsigner is located inside java JDK_HOME/bin)

OTHER TIPS

I got the same "You uploaded an APK that is not zip aligned... blah, blah" error when by mistake I tried to upload a DEBUG version of my .apk file to Google Play. It's a bit misleading error because the real problem is that you cannot distribute a debug version which additionally is not signed with your Google Android Developer key. (You can only upload an .apk compiled as release version, and it must be signed, which happens in the same step, at least if you're using Eclipse).

Make sure you distribute an .apk file which is your Signed Release version, as described here:

http://developer.android.com/tools/publishing/app-signing.html#releasecompile

This question and its answers are old; so we expect things to change. As of today, the zipalign tool is in the ANDROID_HOME directory under build-tools/[version]/ so my path is currently:

/android-sdk/build-tools/22.0.0/zipalign

Using the zipalign tool is not necessarily the answer here though, what you actually need to do is sign your apk.

Steps if using Xamarin for VS2017:

  1. Build project
  2. Right click and Archive project
  3. Use Ad Hoc distribution channel
  4. Sign your APK with your Signing Identity and Save As to produce an APK that is ZIP aligned.

Your APK can be uploaded to Google Play.

I was using Cordova, uploaded a signed APK but still got this error.

The ziptool is what helped me, it's located at ~AndroidSDK\build-tools\24.0.0\zipalign.exe

So for example :

"~\AndroidSDK\build-tools\24.0.0\zipalign.exe" -f -v 4 android-release-signed.apk android-release-signed-zipaligned.apk

I was using Cordova and the command line getting this error. I opened the project in Android Studio and used Android Studio to build the signed apk and the error went away.

When using the Cordova node.js CLI without going through Android Studio, it is necessary to update the PATH environmental variable to include the android build tools:

%ANDROID_HOME%\build-tools\29.0.2

Obviously the version number will change over time. Remember to close any CLI windows and re-open them to recognize the newly added path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top