I am having trouble setting the Android_Home variable on my MacOS. I have the MacBook Pro 2016 edition. Can't seem to find .profile. I tried to create it but looks like it didn't take. Any thoughts?
Thanks. -Nathan
I am having trouble setting the Android_Home variable on my MacOS. I have the MacBook Pro 2016 edition. Can't seem to find .profile. I tried to create it but looks like it didn't take. Any thoughts?
Thanks. -Nathan
The file is called .bash_profile and can be found in your home directory (/Users/<username>)
To add your ANDROID_HOME environment variable there, you would need to add the following line to your .bash_profile
export ANDROID_HOME=/path/to/android/sdk
To apply the changes, restart your terminal. Confirm that the changes have been applied by typing the following in your terminal:
echo $ANDROID_HOME
Your output should be /path/to/android/sdk as entered above.
These line should be add to your Shell Initialization Files:
export ANDROID_HOME=/Users/{YourUserName}/Library/Android/sdk
export ANDROID_NDK=$ANDROID_HOME/ndk-bundle
bash (by default), you should add these lines to your ~.bash_profile or ~.bashrczsh, you should add these lines to your ~/.zshrc Old school way to check if .bash_profile file exists following could be done:
Finder>Go>COMPUTER>Mac HD>Users, THEN click on your user account.⌘ + ⇧ + ., this will now display hidden files and folders. It will look something like this:In case the ⌘ + ⇧ + . does not work, please look up the keyboard shortcut relevant for your Mac Operating system name.
If you are setting up the ANDROID_HOME environment variable on macOS Catalina, .bash_profile is no longer Apple's default shell, and it won't persist your path variables. Use .zprofile instead and follow the environment setup instructions in react-native documentation or others. .bash_profile will keep creating new file which won't make the path permanent or persist on closing the terminal on your system path.
To create a new path just do this in macOS Big Sur:
sudo touch ~/.zshrcsudo nano ~/.zshrcsource ~/.zshrcecho $PATH