Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zipalign: command not found - Ubuntu

Tags:

android

ubuntu

I am trying to zipalign an "input.apk" file on an Ubuntu 14.04 LTS system using the command line as I do not have access to the source code just yet. If I'm not mistaken I should be able to do this with the following command

zipalign [-f] [-v] 4 intput.apk output.apk

but I am getting the following output

zipalign: command not found

I have made sure that the zipalign file is in my ...sdk/tools directory which I had to copy over from my ...build-tools/android-4.4W folder because it was originally missing. When I input this line as suggested in another question

./zipalign [-f] [-v] 4 intput.apk output.apk

I get the following output

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

Usage: zipalign [-f] [-v] <align> infile.zip outfile.zip
       zipalign -c [-v] <align> infile.zip

   <align>: alignment in bytes, e.g. '4' provides 32-bit alignment
   -c: check alignment only (does not modify file)
   -f: overwrite existing outfile.zip
   -v: verbose output

Does this mean that I need a .zip file instead of my .apk to zipalign?

like image 503
himahimahima Avatar asked Jul 21 '14 04:07

himahimahima


2 Answers

In terminal,

cd /opt/android-sdk/build-tools/21.1.2

sudo ln -sf zipalign /usr/bin/

zipalign -v 4 platforms/android/ant-build/MainActivity-release-unsigned.apk platforms/android/ant-build/YOUR_APP.apk
like image 133
gilcierweb Avatar answered Oct 02 '22 20:10

gilcierweb


When a usage message contains an argument in brackets, the brackets mean that that argument is optional and can be left out of the final command; the brackets are not themselves part of the command syntax.

In your case, correct usage might look like:

./zipalign -v 4 intput.apk output.apk 
like image 31
Haresh Chhelana Avatar answered Oct 02 '22 22:10

Haresh Chhelana