Zipalign doesn't work

Hello,

I’m trying to use zipalign but I don’t know what is wrong. When I run the command I receive this output:

Zip alignment utility
Copyright (C) 2009 The Android Open Source Project

Usage: zipalign [-f] [-p] [-v] [-z] infile.zip outfile.zip
zipalign -c [-v] infile.zip

: alignment in bytes, e.g. ‘4’ provides 32-bit alignment
-c: check alignment only (does not modify file)
-f: overwrite existing outfile.zip
-p: page align stored shared object files
-v: verbose output
-z: recompress using Zopfli

I tried to run:
~/Library/Android/sdk/build-tools/25.0.0/zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk MyApp.apk

~/Library/Android/sdk/build-tools/25.0.0/zipalign zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk MyApp.apk

~/Library/Android/sdk/build-tools/25.0.0/ zipalign -v 4 platforms/android/build/outputs/apk/android-release-unsigned.apk MyApp.apk

Is there a platforms folder in the folder you are executing this? If not, your command is wrong.

Yes, the android-release-unsigned.apk file exists

Not my question. Is the platforms folder really in the zipalign folder? This seems strange.

I think he is in the ionic folder calling zipalign on it’s full path. So the first version should be correct.

@diegomachado have you tried to write the path to your apk with TAB to autocomplete the path, just to be sure that there is not an error there?

I would recommend to add ~/Library/Android/sdk/build-tools/25.0.0/ this path to your PATH variable so you can call zipalign directly in the terminal. Or run the command directly in the folder with the apk. Just to verify maybe copy the apk in the folder where zipalign is situated.

2 Likes

Ah, got it. Sorry @diegomachado

1 Like

Well, I can’t run the command. I’m using ionic package to create my apk’s files. It’s more simple to use. When I have more time I’ll try to fix the zipalign issue.

Thank you @Sujan12 and @tobika