We have a set of unix tools that were ported to windows and I want to use the zip command to package a set of files.
I'm trying to do this:
Open cmd from desktop and take the files in r:\pam\client\ssb\portfoliorepportcards\202003\*.docx and create a zip file in r:\pam\client\ssb\PortfolioReportCards\202003.zip with the files in it.
My command is:
C:\Users\JPalomino\Desktop>zip.exe -b "r:\pam\client\ssb\PortfolioReportCards" 202003.zip . -i r:\pam\client\ssb\portfoliorepportcards\202003\*.docx
zip error: Nothing to do! (202003.zip)
and I get nothing
However when I cd to r:\pam\client\ssb\portfoliorepportcards and do
R:\Pam\Client\SSB\PortfolioReportCards>zip -r 202003.zip . -i \202003\*.docx
it works like a charm. Also I wouldn't want the folder structure in it.
Could you please tell me what I'm doing wrong in the command? It seems such an easy thing to ask from zip.
Thanks
Maybe this will help, you don't need zip.exe (if you have powershell 5 or higher)...
powershell -command "Compress-Archive -Path 'r:\pam\client\ssb\PortfolioReportCards\*' 'r:\pam\client\ssb\PortfolioReportCards\202003.zip'"
I saw you're having trouble zipping to another drive letter, this should help with that too. I'm not really familiar with zip.exe to know why that's giving your grief.
Anything else you "port" to cmd is probably better off as a powershell. --- also if "zip.exe" isn't on your desktop that could possibly be your problem right there. If it works when you CD that tells me it's probably located where you're CD'ing to. Perhaps add zip.exe as an environment variable so that it can be accessed globally instead of only from the working directory.
And my take one your command (If zip is actually on your desktop or set as environment variable... : zip.exe -b "r:\pam\client\ssb\PortfolioReportCards" 202003.zip . -i r:\pam\client\ssb\portfoliorepportcards\202003\*.docx
I would re-write that and try this instead (because traditionally the filepath is all in quotes for any other windows command I know of)...
zip.exe -b "r:\pam\client\ssb\PortfolioReportCards\202003.zip" . -i r:\pam\client\ssb\portfoliorepportcards\202003\*.docx
When I try to run Zipalign on an apk I get the error "Command not found"
I am not that familiar with using terminal commands on the MAC but I have navigated to the SDK/Tools folder and run the following command:
zipalign -v 4 Project1.apk Project1-aligned.apk
I get Command not found
I have tried placing the apks in the Tools folder and same result.
Can someone help me to understand where the apks should be located and where I should run zipalign from?
Thanks, I am very frustrated about this as it seems so simple.
You can find correct path with this command:
find ~/Library/Android/sdk/build-tools -name "zipalign"
Perhaps the current directory is not in your path?
Try adding "./" before your command so
./zipalign -v 4 Project1.apk Project1-aligned.apk
You will find the zipalign tool at /path/to/sdk/build-tools/<build-tools-version>/zipalign NOT in the tools folder anymore.
~/Library/Android/sdk/build-tools/xxxx/zipalign
Drag this to terminal or save this in your path.
xxxx -> Version
Zipalign is a command that located at $ANDROID_HOME/build-tools/{android-version}/.
Hope it helped.
A simple one-liner:
This adds a line in your profile, to add the directory which contains the zipalign executable to your path
Then reloads the profile
echo "export PATH=\$PATH:~/Library/Android/sdk/build-tools/23.0.1/" >> ~/.bash_profile && . ~/.bash_profile
Make sure to replace 23.0.1 with your installed version
$ ls -l ~/Library/Android/sdk/build-tools/
total 0
drwxr-xr-x 23.0.1 <---
Now you should be able to use zipalign regardless of your current working dir
$ zipalign
on the mac with the zsh console, my solution was
command 1)
find ~/Library/Android/sdk/build-tools -name "zipalign"
----------------------------------------------------------
/Users/macOs/Library/Android/sdk/build-tools/28.0.3/zipalign
/Users/macOs/Library/Android/sdk/build-tools/26.0.2/zipalign
/Users/macOs/Library/Android/sdk/build-tools/25.0.2/zipalign
/Users/macOs/Library/Android/sdk/build-tools/27.0.3/zipalign
command 2)
echo "export PATH=\$PATH:~/Library/Android/sdk/build-tools/28.0.3/" >> ~/.bash_profile && . ~/.bash_profile
command 3)
ls -l ~/Library/Android/sdk/build-tools/
command 4)
zipalign -v 4 app-release-unsigned.apk nameApp.apk
2hours resume for newbies (like me) :
If you type this command :
zipalign -v 4 platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk app-release.apk
Witch gives you :
command not found: zipalign
It's maybe that the path is somewhere wrong.
If you have this :
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/apt" (-1)
It confirms that its not really as it should be. So, to execute zipalign and finally publish your app, you have to go in the correct repository and execute commande.
1. Go to the correct repo to execute command :
The path is cd /Users/xxxyour_user_namexxx/Library/Android/sdk/build-tools/xxxxx/
cd /Users/greg/Library/Android/sdk/build-tools/28.0.3
2. Execute your zipalign command, don't forget to precise the path of apk file :
Obviously, chance "greg" and "myapp" with your user name & app name.
./zipalign -v 4 /Users/greg/Desktop/AppLocal/myapp/platforms/android/app/build/outputs/apk/release/app-release-unsigned.apk /Users/greg/Desktop/AppLocal/myapp/platforms/android/app/build/outputs/apk/release/app-release.apk
Hope it helps.
Search it and reference it... I have it here and reference it like this:
/Users/lioncio/Desktop/adt-bundle-mac-x86_64-20140702/sdk/build-tools/android-4.4W/zipalign bla bla bla (all the options of the command!)
And worked
Relax! , Just Use Locate Command in Terminal WHEREVER it is , it will come out
tom-MacBook-Air:kavform_app tom$ locate zipalign
/Users/tom/Software/android-sdk-macosx/build-tools/24.0.1/zipalign
/Users/tom/Software/android-sdk-macosx/docs/tools/help/zipalign.html
In my case it was burried over here
/Users/tom/Software/android-sdk-macosx/build-tools/24.0.1/zipalign -v 4 /Users/tom/kavwork/kavform/kavform_app/platforms/android/build/outputs/apk/android-release-unsigned.apk BrideToBe.apk
add it to the path
on terminal
find path for zip align
find ~/Library/Android/sdk/build-tools -name "zipalign"
path: /Users/username/Library/Android/sdk/build-tools/26.0.1/zipalign
enter the path found in there
sudo nano /etc/paths
now on new terminal you can see zipalign reco
Solution for Mac
This error basically means that the terminal wasn't able to find the zipalign file.
So you can either type in the full path for your zipalign file with the command (located in your Android build-tools folder)
/Users/username/Library/Android/sdk/build-tools/26.0.1/zipalign -v 4 android-armv7-release-unsigned.apk helloWorld.apk;
If you do not know the location of the zipalign file, then just use this command
find ~/Library/Android/sdk/build-tools -name "zipalign"
If you are working on Windows, change the command prompt to point to the folder containing the zipalign.exe and then run the command. Also, I have found that you are not using the complete command:
zipalign [-f] [-v] 4 Input.apk Output.apk
cd android-sdk/build-tools/22.0.0/ - change directory to android sdk folder, build tools and choose version (I used 22.0.0).
Then at the prompt type:
./zipalign -v 4 /MyApp/android-x86-release-signed.apk ~/MyApp/android-x86-release-signedandzipped.apk
That worked for me. I tried the other solutions above with no success. I just had to run the command withn the proper folder, but that wasn't explained clearly in other resources I checked.
Navigate to the path of the zip align and include that with the command
/Users/ignatiusandrew/Library/Android/sdk/build-tools/25.0.2/zipalign 4 android-release-unsigned.apk igi.apk
Alternatively, if you do not want to add a specific build tools folder to the path, in case it changes in the future, you can use the first result of find command:
$(find ~/Library/Android/sdk/build-tools -name "zipalign" | head -n 1) <your-zipalign-parameters>
It might be especially useful in a CI pipeline.
for me this worked perfectly, I copied the zipalign file from the android path to the folder where I wanted to run command and then typed ./zipalign -v 4 android-release-unsigned.sdk nameofapp.apk
Note: It was on Mac
%ANDROID_HOME%\\build-tools\\25.0.2\\zipalign -v 4 .\\platforms\\android\\build\\outputs\\apk\\input.apk .\\path\\ output.apk
First,
if your android home is set, then you can just
cd $ANDROID_HOME
and
open . (This should be - /Users/username/Library/Android/, you can just cd to that path as well)
Next, navigate to "sdk/build-tools/25.0.3/" (version 25.0.3 in this case, yours may be a different version).
At your terminal (apk prompt), drag zipalign to the terminal and
...../zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk.
Should work fine.
Hope it helps.
Downloaded zipalign-file from github
zipalign exec copy and paste in your Project1-aligned.apk directory
./zipalign -v 4 Project1.apk Project1-aligned.apk
In my case
I follow below answer
Change directory
/path/to/sdk/build-tools//zipalign
Type
./zipalign instead zipalign
In short ./zipalign is solution for me.
Solution for Jenkins
For Jenkins users using MacOS to build and sign mobile apps who are experiencing this error, the solution could be this:
At the stage where the signature is made:
withEnv(['PATH=/Users/jenkins/Library/Android/sdk/build-tools/29.0.3',
'ANDROID_SDK_ROOT=/Users/jenkins/Library/Android/sdk',
'JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_301.jdk/Contents/Home'])
I am using Windows with git bash/command promt
zipalign.exe needed to be configured in environment variables.
so include sdk folder 'build-tool' with android version folder you are using to build.
e.g. E:\android-sdk\build-tools\22.0.1
it should contain 'zipalign.exe'. now you can user
zipalign -v 4 Project1.apk Project1-aligned.apk
from any location using command line tools.
thumb up for me so i can help more developers.
I have currently put together a script to move files from one directory to another.
This has gone ok however I was wondering if there was a way via a shell script to get it to run from anywhere on the server e.g I give the script for someone to use on their server and they can put the script anywhere and it will run.
I know a workaround is to put the script in /usr/local/bin or usr/bin and you can run it from anywhere but that is not what I want.
Is there a way that my script will auto run from usr/local/bin regardless of if it is in /scripts for instance?
Please see my script below:
#!/bin/sh -x
mkdir -p /var/Alitest
echo "This is a test that I have created. This is to
see if the output is successful I normally do this manually but a script is required" > /var/Alitest/action.txt
sed -i 's/This is a test that I have created/The test has been successful/g' /var/Alitest/action.txt
chmod 744 /var/Alitest/action.txt
chown root:root Alitest/action.txt
mv /var/Alitest/action.txt /script/action.txt
Any help would be greatly appreciated :)
Also in my log output for the script the following error is shown:
sed: 1: "/var/Alitest/action.txt": invalid command code A
Any ideas?
You can make a soft link in /usr/local/bin for your script. Then it will be in everyone's path to be executed.
e.g. ln -s /script/yourscript.sh /usr/local/bin/yourscript.sh
After reviewing the matter further I have decided the the best way to action this is to add the folder destination e.g /scripts to my path.
This can be done by vimming into the .bashrc file on the server and adding the below line:
export PATH=/dir_name:$PATH
remember to refresh the profile in order for the changes to take effect.
You can check if this has been successful by running the below command:
echo $PATH
There is no way to get your script to do this however this would be better then a softlink as if you add it to $PATH then you do not have to go through the task of adding softlinks each time.
Thank you all for your help.
Kind Regards
Ali
I have the .gcda and .gcno files in a folder, from which I am running the below command.
$ gcovr -r .
and the result is as below
if I run gcov on the gcda files I get the proper coverage value.
After a tedious search in multiple forums and countless experiments, finally I figured out the issue and resolved it.
Two things are important to get the proper output from gcovr.
One is from where the gcovr is executed and other is the root directory path.
gcovr should be executed from the folder where the .gcda and .gcno files exist. And the root path is the folder where the source files(.c or .cpp) exist.
With this, the command looks like something as shown below.
rr-mac:gcdaFolder$ gcovr -r /path_to_C_sourceFiles/ .
For output html file below command works
rr-mac:gcdaFolder$ gcovr --html -o Filename_rp.html -r /path_to_C_sourceFiles/ .
Note: The dot(.) at the end is mandatory
Hope this is helpful for those who are struck with this type of issue.
I've run into a problem while running a tar script. I am getting an invalid option, as shown in the screenshots, that is stopping the script running. I don't get why however as the command worked outwith the script. Can anyone help me?
The script:
The error:
Thanks to Paul R I have an answer. No idea how to mark his comment as the answer though so here it is:
Some older versions of tar don't like the - at the start of the
commands - try tar cvpfz .... – Paul R 5 mins ago
Are you copy and pasting the command, instead of hand-typing it in terminal?
In my case, I was getting:
tar: invalid option -- '�'
I was pasting into terminal, the command from a raw text file, which I had copied from a tutorial:
tar –xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
I hand-typed the entire command:
tar -xvzf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
and it worked. I suspect it was something like an extra space character or a - or similar which was not working.
In my case, i tried chmod 777 'FILE_NAME' for unlock the file.
Then installing, it works well!