zipalign' is not recognized as an internal or external command - android

I Wrote an android app.
I type zipalign myApp.apk on cmd at windows 7 and I get:
zipalign' is not recognized as an internal or external command operable program or batch file
What is the problem

zipalign.exe can be found in the build tools (my path in my PC is C:\Users\[user name]\Developer\adt-bundle-windows-x86_64-20131030\sdk\build-tools), in my builds 19.1.0 and 20.0.0 folders. If you can't find it, fire up Windows Explorer and search for zipalign.exe, likely in C:\, unless you have installed in another drive.
Copy zipalign.exe to the tools folder, same level as build-tools (in my case, it is C:\Users\[user name]\Developer\adt-bundle-windows-x86_64-20131030\sdk\tools). Once done, I could compile successfully.

Go to
Android/sdk/build-tools/VERSION/zipalign
copy the zipalign.exe into the current directory
and then run it.
Example:
Now to optimize the APK , run the following command
E:\app publish\J\JQuery Reference>zipalign -v 4 jquery-reference-unsigned.apk jq
ueryReference.apk

An example on how to run zipalign without adding the path variable from CMD prompt:
C:\Users\mywindowsusername\AppData\Local\Android\Sdk\build-tools\27.0.3\zipalign.exe -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk

You should navigate to the directory wich has the zipalign executable in it.

Zipalign.exe is located in /path/to/android/sdk/build-tools/sdk-number
In command line:
Navigate to the location where zipalign.exe can be found
Run: zipalign -v -f 4 /full/path/to/apk/unaligned-apk.apk /full/path/to/new-aligned-apk.apk

you can also try this:
1.search for zipaligned in main search bar
2.copy it to current directory
3.run your commands without changing anything
4.it works! :)

Try this
zipalign -v 4 app-release-unsigned.apk xxx.apk
instead put infront of above command
./
while you run it in terminal
\platforms\android\app\build\outputs\apk\release>./zipalign -v 4 app-release-unsigned.apk xxx.apk

If you are using powershell like I was, exit and use standard windows command prompt and then it will execute :)

Copy zipalign exe file into the Android\Sdk\build-tools\ folder and add path in environment variables ...

im comming from ionic-doc, and thiew way works form me by adding this to PATH
/path/to/Android/sdk/build-tools/VERSION/zipalign

Related

Creating img database with arcoreimg tool

I'm having issues to create an image database (.imgdb) for my arcore project. I've downloaded arcore sdk for android and inside the folder tools there's arcoreimg for mac. When i try to follow the steps in here:
https://developers.google.com/ar/develop/c/augmented-images/arcoreimg
the following is not working:
./arcoreimg build-db --input_image_list_path=/path/to/image_list_file.txt \
--output_db_path=/path/to/myimages.imgdb
(changing the path to my images obviously)
It says arcoreimg command not found when i execute it in the Terminal. What should i do? Any ideas?
Had the same problem, making the file executable fixed the problem for me:
sudo chmod +x arcoreimg
The official documentation doesn't point to the right steps.
First, locate the arcoreimg file on your system. On MacOS, I found it inside <arcore-sdk-location</arcore-android-sdk/tools/arcoreimg/macos.
You can use the executable directly from here, or copy it to a more convenient location (maybe next to your images).
I copied it next to my images, opened the terminal in the folder, and then used the eval-img command, but the build db command should work the same way-
./arcoreimg eval-img --input_image_path=dog.jpg
This might give permission denied or command not found.
sudo chmod +x arcoreimg should fix this.
Step 1: Give read/write access to your tool. Open your arcoreimg directory from terminal. And give following command
sudo chmod +x arcoreimg
Step 2: Copy your images in one folder
Step 3: Create one empty output folder
Step 4: Give following command
./arcoreimg build-db --input_images_directory="yourInputDirectoryPath" --output_db_path="yourOutputDirectoryPath/databaseName.imgdb"
Sample command
./arcoreimg build-db --input_images_directory=/Users/ranjithkumar/Desktop/input_images --output_db_path=/Users/ranjithkumar/Desktop/output_db/myImages.imgdb
I believe the official documentation on using this may not be very clear, as this portion ./arcoreimg of the sample code refers to the exact directory where your arcoreimage cli tool is located, as well as the name it is called. So you may correctly run the code like this;
/Users/.../GoogleARCore/CLI/augmented_image_cli_osx build-db --input_image_list_path=/path/to/image_list_file.txt \
--output_db_path=/path/to/myimages.imgdb

Publishing Ionic app - Zipalign not working

I am trying to get my Ionic app published. However, when trying to zipalign the apk with the following command
/Users/bertcarremans/Library/Android/sdk/build-tools/23.0.3/zipalign zipalign -v 4 android-release-unsigned.apk chartly.apk
I get the message below:
Zip alignment utility
Copyright (C) 2009 The Android Open Source Project
Usage: zipalign [-f] [-p] [-v] [-z] <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
-p: page align stored shared object files
-v: verbose output
-z: recompress using Zopfli
How can I make the zipalign tool to work? Thanks!
I found the solution.
Copy the zipalign tool to the apk folder of your app. On my computer the zipalign tool was located in /Users/bertcarremans/Library/Android/23.0.3
Then run the command ./zipalign -v 4 android-release-unsigned.apk chartly.apk
There is no need to copy zipalign file anywhere, if it is installed through command line a symbolic link will be created and then you can run it from anywhere.
You are not using the right syntax of the zipalign tool. Please check again, you have written zipalign twice so you are passing zipalign as a parameter to zipalign command which is not correct.

How to build a JAR file using ant for uiautomator test project

I have been trying to get my head around using uiautomator and I understand creating the test cases. I tried the first two steps of building the JAR according the the Android developer guide for UI Testing (http://developer.android.com/tools/testing/testing_ui.html) and that worked fine, but I am unsure on how to follow the next steps and building the JAR file with ant. Please can anyone help me with this issue.
Here are the steps that I have done so far:
<android-sdk>/tools/android create uitest-project -n <name> -t 1 -p <path>
set ANDROID_HOME=<path_to_your_sdk>
This is the step that I am stuck on:
ant build
The error I get when I use the command prompt is:
'ant' is not recognized as an internal or external command, operable program or batch file.
In the terminal run
which ant
It seems you do not have ant installed. If no location like /usr/bin/ant shows up after you run the command above, use this to install it:
sudo apt-get install ant
Try again after. It should work.
If you're using ADT, I recommend downloading Apache ant and placing it within the sdk/tools/ant folder. Then change your PATH variable to direct to the ant bin folder.
you have this error because you wrote "ant build" from incorrect path.
I did (this command generate build.xml, local.properties, project.properties files):
<android-sdk>/tools/android create uitest-project -n <name> -t 1 -p <path>
I changed in build.xml first line like:
<project name="name" default="build">
after that I run ant from eclipse. Build was success.
Have you installed ant? If not then do it from this site: http://ant.apache.org/manual/install.html
If yes then follow these steps:
Navigate to your project directory and means (go to bin of your project)
Using command window execute the function: ant build
Ensure that your default JAVA_HOME points to JDK installation, not the JRE, and check if your compiler is in the PATH. Try to type “javac” in the command prompt. If javac is not found, then you should put your bin directory in the PATH.
For example, in Windows:
SET PATH=c:/jdk1.5.0_07/bin;%PATH%
This site might help further: http://looksok.wordpress.com/2014/02/08/uiautomator-in-eclipse/
If you have ADT with Eclipse then you can find ant in the plugins directory of Eclipse.

android is not recognized as an internal or external command

So I'm having the same issue as this guy in this question
android' is not recognized as an internal or external command
But when I changed my PATH variable and added the path to android.bat my cmd still does gives
'android' is not recognized as an internal or external command,
operable program or batch file.
My PATH looks like this
D:\Program Files\Java\jdk1.7.0_04\bin;D:\BossGrand\Programing\Ant\apache-ant-1.8.4\bin;C:\Program Files\TortoiseSVN\bin;D:\Program Files\Android\tools
and I made sure android.bat is inside D:\Program Files\Android\tools
I know this because when I go to this directory I can use the android update project command just fine
Does anyone know why I still can't use the android command?
Use the command prompt with admin .It work for me : )
You might have installed Cygwin as part of the SDK. I had the same problem "android.bat is not recognized as an internal or external command". So, Uninstall the Cygwin and try again (you might not able to uninstall Cygwin, since a mysterious “permission denied” when deleting the Cygwin files by default). You need to own access to this mysterious Cygwin files by doing
Take ownership: takeown /r /d y /f cygwin (do this, wherever is your cygwin folder is)
This command takes ownership recursive of the folder, without asking anything and gives Full Access to Everyone recursively in the folder:
icacls cygwin /t /grant Everyone:F And finally, the command which deletes it all and removes Cygwin:
rmdir /s /q cygwin Good bye Cygwin!
Now try again. (This worked for me)
PS: You can always re-install cygwin again. So, nothing wrong giving it a try. Good Luck
you must enter the command with complete arguments
android update project -p .
be carefull you must enter a dot at the end of command.

How to build .apk file from Windows command-line?

How can I build and signed (keystore) the .apk file using 'apkbuilder.bat' via windows command-line ?
I try to run the following line:
apkbuilder.bat %APK_File_Name% -u -z %Project_Path%\bin\resources.ap_ -f %Project_Path%\bin\classes.dex -rf %Project_Path%
but I'm getting the following exception:
java.lang.ArrayIndexOutOfBoundsException: 1
at com.android.sdklib.build.ApkBuilderMain.main<ApkBuilderMain.java:61>
Please help. Thanks
You can do it in command line (.bat) in windows using ant.
with:
"ant release"
You build the apk unsigned.
Then you need to add the call to "jarsigner" and "zipalign" in the bat to complete the task.
You can find an example of the command line to call these tools here:
http://developer.android.com/guide/publishing/app-signing.html#signapp
Best,
I would suggest using Ant and the build files generated by the Android tools rather than trying to handroll your own. If nothing else, you can use the build files as a reference to determine how it uses the various tools to perform each step.

Categories

Resources