Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You uploaded an APK that is not zip aligned error

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 .

like image 917
Anas Avatar asked Mar 27 '14 08:03

Anas


People also ask

What is ZIP align for APK?

zipalign is a zip archive alignment tool. It ensures that all uncompressed files in the archive are aligned relative to the start of the file. This allows those files to be accessed directly via mmap(2) , removing the need to copy this data in RAM and reducing your app's memory usage.

What is unaligned APK?

The unaligned apk is just an intermediate product. the unaligned apk is generated. the unaligned gets aligned and produces the aligned apk.

Are APK files zip files?

Any APK file is a valid ZIP file. There's more to it than that - files that must be present, the fact that zipalign is normally used to align data structures within the file - but it's all valid ZIP.

How do I format an APK file?

Creating a Signed APK File To generate a signed APK file, open the Build menu from the toolbar and select Generate Signed Bundle/APK. This opens up a screen where you have to select between creating an Android App Bundle and creating an APK file.


2 Answers

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)

like image 124
Minas Avatar answered Sep 29 '22 01:09

Minas


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

like image 32
Derek Gogol Avatar answered Sep 28 '22 23:09

Derek Gogol