How to zip Align APK file in android?
Asked Answered
V

6

38

I am uploading my first APK file to google play but I am getting following 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.

Can any one tell me how to zip align my apk file ?

Please tell me steps for that ?

Verbenaceous answered 28/4, 2014 at 6:11 Comment(13)
Did you checked this ? #5321026Folie
You need to use zipalign [-f] [-v] <alignment> infile.apk outfile.apk for that.Bedelia
ok where I can do that?Verbenaceous
In Command prompt....Bedelia
Acctully I had followed the steps and ignore all errors but still I am getting same messageVerbenaceous
@LuckyyNickey No. I think you didn't use it proper way.Bedelia
What is alignment? @PiYusHGuPtAVerbenaceous
Ohk then what can I do now???? acctully I had already done this now Can I overrite this one?Verbenaceous
You just need to use that way fixed which can be converted your source apk to new destination apk with zipBedelia
Hey Now I have verification successfull.. Now?? @PiYusHGuPtAVerbenaceous
@LuckyyNickey Now you have just use your destination apk and upload it to Google play if you have done all process.Bedelia
Its the only proccess? do I need to Right Click on Project Folder->Android_Tools->Export Signed Application Package...Verbenaceous
HEy Please see my edited question I am getting error in uploadingVerbenaceous
G
14

Read the documentation from Google itself

The steps should be simple to follow.

Please follow this doc from google for complete publishing details

In short,complete steps in a nutshell(I am assuming you use eclipse/android sdk):

 1. Check android_manifest.xml and verify that android:debuggable  attribute is set to false in your manifest file            
 2. Check the android:versionCode and android:versionName attributes. 
    (if this is the first time you are uploading a apk,   
    ignore, else if it is a new version of existing apk, make sure these   
    values are larger than previous apk)
 3. Export unsigned application package from Eclipse
 4. Sign the application using release key certificate(not debug key certificate)
 5. Zip align the package
 6. Upload in google play
Galven answered 28/4, 2014 at 6:17 Comment(8)
Hey Now I have verification successfull.. Now?Verbenaceous
congrats.. so you have signed the apk and then zip aligned it right? Now go ahead and upload it in google play :)Galven
yes.. and let me know once you are done/face any issuesGalven
Hey I am getting Error.. "You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs. You uploaded an APK that was signed in debug mode. You need to sign your APK in release mode. Learn more about signing."Verbenaceous
updated my answer. Please read the link to doc I mentioned carefully. Its complete and perfect.Galven
Ok thanks Do i need to export unsigned APK file? acctully I had export signed apk fileVerbenaceous
yes you need to export unsigned apk file, and then sign it separately with a release certificate(if u export signed one, eclipse will sign with a debug certificate only, and google play doesn't like debug certificates)Galven
"You uploaded an APK that was signed in debug mode. You need to sign your APK in release mode. Learn more about signing." How to debug to relese modeVerbenaceous
S
13

If you use Eclipse export wizard, it will automatically align it for you. However you can do it manually yourself

To align infile.apk and save it as outfile.apk:

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

This website can provide more answers :) http://developer.android.com/tools/help/zipalign.html

Slighting answered 28/4, 2014 at 6:17 Comment(6)
Hmm what is alignmend?Verbenaceous
Hey Now I have verification successfull.. Now what to do?Verbenaceous
Hey I am getting error while uploading. Please see my edited questionVerbenaceous
<alignment> must always be 4Supralapsarian
@LuckyyNickey: Please ask a different question rather than editing your solved question.Supralapsarian
The <alignment> is an integer that defines the byte-alignment boundaries. This must always be 4 (which provides 32-bit alignment) or else it effectively does nothing.Teary
F
10

try below link or code:-

To align infile.apk and save it as outfile.apk:

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

To confirm the alignment of existing.apk:

zipalign -c -v <alignment> existing.apk

The is an integer that defines the byte-alignment boundaries. This must always be 4 (which provides 32-bit alignment) or else it effectively does nothing.

Flags:

-f : overwrite existing outfile.zip
-v : verbose output
-c : confirm the alignment of the given file

http://loomsdk.com/forums/loom-with-loomscript/topics/uploading-apk-to-google-play-displays-error-not-zip-aligned

http://developer.android.com/tools/help/zipalign.html

http://www.youtube.com/watch?v=ReRCJgS-g9o

Flattie answered 28/4, 2014 at 6:18 Comment(2)
Hey thanks but I am getting the error. Please see my edited questionVerbenaceous
@LuckyyNickey see this link #19995374Flattie
P
4

Check themanifest.xml file in your project it should say something like this:

android:debuggable="true"

set it to "false".

Phallic answered 7/11, 2014 at 2:7 Comment(0)
L
3

If you use eclipse the easiest way is to do it directly from it.

Go to "File" -> "Export" -> "Android Application Export"

Select Android Application Export

The tool would ask you if you already have a keystore, if you do use it if not create a new one and save it on a safe place (you must remember the password so be sure to keep it somewhere you cannot lose it).

Then upload the file and there should be no errors.

Ladykiller answered 10/11, 2014 at 20:54 Comment(0)
S
1

I had a similar issue and tried all of the hints that are listed here but not cigar, I thought it was a bug but all my other Apps would work is just one of them had the issue e.g. after passing the not zip align I'd get You uploaded a debuggable apk. I was generating the apk from Eclipse/Indigo and the problem was the last step where it specifies the apk path somehow was pointing to some subdirectory had no idea how that one got in there, but using the proper path took care of it.

Scoutmaster answered 12/12, 2014 at 14:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.