How to get zipalign for mac? - macos

I already have a release unsigned version apk and I am trying to sign it on my mac. On the last step it suggests to zipalign the signed apk but mac doesn't have zipalign.
I did 'brew search ' still can't find it. I searched online and can't find standalone zipalign script. I even downloaded around 90M Android sdk tool from http://developer.android.com/sdk/index.html#Other but still found no zipalign inside.
So my question is, given you an "apk" file to sign on mac, how to get through the last "zipalign" step?

Thanks the info from RC.
I finally got through this. I did in following steps:
Download 250M+ android studio ide dmg from official site. Drag it into Application folder
Open it, and it automatically downloads a lot of additional stuff
I even created a empty new project.
Then in certain step(I am not sure which step) it created zipalign here:
~/Library/Android/sdk/build-tools/22.0.1/zipalign
If you only need "zipalign", you don't need to redo those steps, which takes time and disk space. I extracted it into the github(Can't believe no one has extracted it -_- ):
https://github.com/catccaatt/zipalign

From your Mac terminal:
Add adb to command line path:
echo 'export ANDROID_HOME=/Users/$USER/Library/Android/sdk' >> ~/.bash_profile
Add build tools to command line path:
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/build-tools/28.0.2' >> ~/.bash_profile
Refresh command line with:
source ~/.bash_profile
Then you can run it with:
zipalign -v -p 4 my-app-unsigned.apk my-app-unsigned-aligned.apk

Related

About setting Flutter SDK path on Mac [duplicate]

I have installed the Android studio and the plugin's DART,FLUTTER to kickstart the flutter but as i am not able to give path of sdk while creating my very first project for flutter.
I tried to find out the solution did not got solution..
Finally this are the steps i have implemented and works for me.
Prerequisites :-
Install Android studio
Install plugins to kick start flutter projects (DART,FLUTTER)
You can find out this inside android studio --> preferences --> Plugins
Now you have to setup Flutter SDK path to your Android studio
Download the Flutter SDK
Extract it where do you want (for example - /Users/vrushali/Downloads/flutter)
Open your Android studio --> start a new Flutter Project --> select default application --> next --> select flutter sdk path --> browse to the . location where you have download and extract your flutter sdk --> select the flutter --> bin --> and say okay
All set..! Your project will get created in some time :)
Theres a better way if you want to skip
Open your Android studio --> start a new Flutter Project --> select
default application --> next --> select flutter sdk path --> browse to
the . location where you have download and extract your flutter sdk
--> select the flutter --> bin
doing every time you open android project
Step1:
open ~/.bash_profile
Step2 paste
PATH="/Users/vrushali/Downloads/flutter/bin:${PATH}"
export PATH
This will add the path permanently
asdf
If you have used asdf to install Flutter SDK.
You can find the location of the flutter by using the following commands,
Open the location of asdf in terminal
open ~/.asdf
Inside the .asdf folder go to installs folder and then to flutter folder. Inside the flutter folder will find the current version of the Flutter SDK as the folder name.
For example, in my case the folder name is 1.12.13+hotfix.7-stable and the path to the folder is /Users/akarshseggemu/.asdf/installs/flutter/1.12.13+hotfix.7-stable
For update flutter SDK path in Mac,
1. First your default shell using echo $SHELL command in Terminal.
2. Use below commane to open vim editor and update Path.
- if it is Bash then type vim $HOME/.bash_profile or vim $HOME/.bashrc
- if Z shell then type vim $HOME/.zshrc
3. Type i to enter INSERT mode (or esc to exit INSERT mode).
4. Type export PATH="$PATH:[YOUR_PATH]/flutter/bin" replacing [YOUR_PATH] with the path to the folder where you moved the flutter folder earlier ex. export PATH="$PATH:/Users/Your_User/Your_Dev_Folder/flutter/bin"
5. Type esc, then :wq! to save and exit.
6. Quit the Terminal and open it again to refresh.
7. Type echo $PATH to check that the path was correctly added.
8. Type which flutter to verify the flutter command is available.
9. Type flutter --version to check the Flutter version.
This worked for me (for ZSH users)
Open terminal & run this command
touch $HOME/.zshrc
Run this command
sudo nano ~/.zshrc
Type the path like this
export PATH=$PATH:/Path to your extracted flutter/Flutter/bin
Press ctrl+x then press y Press Enter Close the terminal and open a
new terminal and run this command
flutter --version
I asked the people that made the flutter plugin and they helped me out. For making flutter work with your IDE (haven't done this in Android but have in VScodium or Vscode).
In command line:
asdf where flutter
In a text document:
export FLUTTER_ROOT="$/asdf/where/flutter/answer/should/go/here"
Add that to your bash_profile above the asdf part. Or your asdf installation won't work.
With nano: ctrl+o, enter, ctrl+x.
Give your IDE the path to the installation, it should work. If not, the change needs to take effect, restart your computer.
Just provide the location where your saved flutter software.

during install pod i am getting this error

Failed to extract git version from git --version. Instead I see:
xcrun: error: active developer path ("/Users/mcbook/Downloads/Xcode.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
Like all macOS apps, the Xcode app is represented in the file system as a folder, even though in Finder we see it as an icon.
In Xcode’s case its main app folder contains subdirectories that include some command line development tools that are necessary when installing apps that need to be compiled.
When you first run Xcode, it registers the location of this subfolder for you. Unfortunately, it looks like you first ran Xcode when it was still sitting in your Downloads folder, and so all your command line tools are still looking for it there.
I’m assuming that in the mean time you’ve moved Xcode – which, as you’d expect, moves all the application folder’s files and subfolders as well – to your /Applications folder.
You should be able to redirect all your tools to look in the new, correct location by using the following command line command:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

Install .tar.gz on MAC

I failed to understand the INSTALL.md file. I know few programming knowledge. I appreciate anyone can give me a thorough explanation or instruction.
The software I wanna install is https://sourceforge.net/projects/scidavis/
Information in INSTALL.md
Mac OS X - MacPorts instructions
These notes refer to use MacPorts. Using other build environments such
as HomeBrew is presumably equally as viable, but you may need to hack
the config files a bit.
Install MacPorts.
Install XCode and XCode command line
tools
If you want to be able to run your build on an earlier version of
MacOSX than your build machine, see How to build a Macintosh
executable that will run on older versions of
MacOSX.
Install the prerequisites for scidavis.
port install qt4-mac qwt52 qwtplot3d boost gsl py27-pyqt4 py-pyqwt py27-sip muparser
Sadly, you may need to do this step multiple times before eveything
is installed
link sip-2.7 share directory to where sip expects it to be:
ln -sf /opt/local/Library/Frameworks/Python.framework/Versions/2.7/share/sip /opt/local/share/py27-sip
Add qt's bin directory to your PATH
PATH=/opt/local/bin:/opt/local/libexec/qt4/bin:$PATH
Configure scidavis
qmake CONFIG+=osx_dist
Build scidavis
make qmake
make
Create the installable package
sh mkMacDist.sh
Thanks in advance
If you are trying to install a tar.gz files you must first run gunzip on the file. gunzip filename. This should give you a .tar file. To open the tar file run: tar -x filename.tar.
NOTE: if you're trying to install a unix executable, it's sometimes easier to use homebrew. Search the internet for the application you're trying to install and the term homebrew, and it might bring up a page on homebrew and give you a simple install command which you can run in the mac terminal.
Steps to install tar.gz on macOS
Double click it the tar.gz file open it
Its contents (e.g. directories/files it contained) should appear in the same directory the tar.gz file is in (to prevent clutter, consider placing the tar.gz file in a new, empty directory before double clicking on it)
One of the new files might be a unix executable that looks like this:
Open another finder window (command + n), navigate to this location /usr/local/bin, and place the executable file you found in the previous step in this new location (you can do this using the mac terminal if you prefer - here's a random example showing show)
At this point, open a new terminal tab, and type the name of the program (the file you moved in steps 4), terminal should recognise the program. However, if you see this there is one more step:
Go to System Preferences -> Security & Privacy -> General tab. Click the lock icon, type password if it asks for it, and then click on 'Allow'.

Code command terminal interface on macOS of Visual Studio Code not works after restart system

I use the command on terminal code file.txt to open file with Visual Studio Code, but when I restart the system, the command stop works. And I need open Visual Studio Code, and reconfigure path to use the code command line interface.
How I can fix this? I'm using macOS HighSierra.
After I restart the system the command apparently fade.
-bash: code: command not found
So your issue may be related to how you installed VSCode
I would run below to install the same
brew cask install visual-studio-code
If you don't want to use brew then I would download the app from below link
https://code.visualstudio.com/docs/?dv=osx
And after unzipping move it to Applications folder in finder.
There may be a possibility that MacOS Gatekeeper is interfering with the location of your app after every restart. Which means the symlink gets invalidated every restart and hence the issue
If the problem still happens after restart, you want to exclude VScode out of gatekeeper
spctl --add "/Applications/Visual Studio Code.app"
Try to repeat again what is described in official documentation.
Check whether Visual Studio Code is installed in the correct folder with the command: ls -l /usr/local/bin/code.
You can find out correct path by running the command which code or where code in bash.
If the command returns path like that: /usr/local/bin/code -> /private/var/folders/xf/vnnm636d0k92w3sc7lm95w040000gn/T/AppTranslocation/3815E4B6-43DB-0F8E-AAB9-EDE3AC7F67CC/d/Visual Studio Code.app/Contents/Resources/app/bin/code
/usr/local/bin, it means that the program was installed in a temporary folder.
The path must be: /Applications/Visual Studio Code.app/Contents/Resources/app/bin/code.
If the program was installed in a temporary folder, this could cause this problem.
Drag Visual Studio Code.app to the Applications folder and repeat
instructions from the official documentation.
If after the above described still does not work and the program is not installed in a temporary folder, it is advisable to check bash settings in ~/.bash_profile and ~/.bash_profile.
P.S.
Also, if none of the above does not help, you can try the following: sudo ln -fs "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code" "/usr/local/bin/".

zsh - OSX - visual studio command line won't stick

which code
code not found
Selecting the Install 'code' command in Path option from the VSCode command palette only fixes the problem temporarily.
The code command works then, even when I restart the terminal.
However, when I restart my computer I am back to
code not found
I can see that code is at /usr/local/bin/code
/usr/local/bin is already in my path.
Check that the symlink /usr/bin/local/code isn't pointing to a translocated version of the VSCode binary. Mine was.
$ ls -l /usr/local/bin/code
code -> /private/var/folders/hz/w...n/T/AppTranslocation/...
To fix
Ensure your VSCode installation is not running in App Translocation. This can happen if you move the VSCode binary to /Applications by, for example, using an Alfred workflow. You must manually drag the binary in to the folder in Finder. (What a drag. Ha ha. But seriously, WTF Apple?)
You can fix this by dragging your existing binary out to the Desktop then back to the Applications folder.
Delete the broken symlink: sudo rm /usr/local/bin/code.
Re-install the link using the command in VSCode ("Install 'code' command in PATH").

Resources