Reputation: 53843
I've been diving into Android development for a while, and now I want to use some project (helpshift) in my app. On the website they have some example apps in which the readme says: Run the following inside the /HelpshiftDemo folder.
android update project -t android-17 -p .
So I do this, but unfortunately this gives me an error saying -bash: android: command not found
. I understand this, because "android" as such doesn't refer to anything on my laptop (Mac OSX). So I thought it is maybe referring to the adb. So I tried replacing android
for the direct path to my adb:
/Users/kramer65/dev/adt-bundle-mac-x86_64-20130917/sdk/platform-tools/adb update project -t android-17 -p .
This gives me a humongous output with more information on adb, which is I guess not the expected result.
So my questions; what does android
refer to, and how can I fix this on Mac OSX?
Upvotes: 41
Views: 65126
Reputation: 21
Update the path.
Open the Terminal program from Spotlight. Run the following command:
touch ~/.zshrc (or ~/.bash_profile) ; open ~/.zshrc (or ~/.bash_profile)
Then save following code
export AAPT_HOME=/Users/****/Library/Android/sdk/build-tools/31.0.0
export PATH=$PATH:$AAPT_HOME
Save the file and quit the text editor. Execute your .zshrc (or .bash_profile) to update your PATH:
source ~/.zshrc (or ~/.bash_profile)
Upvotes: 0
Reputation: 9800
Step 0
The first step is install Android SDK: https://developer.android.com/studio
I don't like the default configurations. I installed SDK in this folder:
/Users/<Username>/Android\ SDK
ℹ️ The default path is
$HOME/Library/Android/sdk
Step 1
The next command open your bash or zshrc configuration file:
Bash profile:
vim ~/.bash_profile
If you use zsh:
vim ~/.zshrc
Step 2
You're ready to update your configurations:
# File: .bash_profile | .zshrc
# Custom path to Android SDK folder.
# If you use the default configuration please change ANDROID_HOME to $HOME/Library/Android/sdk
export ANDROID_HOME=/Users/<Username>/Android\ SDK
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
Step 3
Option 1:
Restart your terminal and you should be able to use android
command
Option 2: source your bash
or zsh
profile.
Example: source ~/.bash_profile
/ source ~/.zshrc
Upvotes: 31
Reputation: 41
Add the following lines into ~/.bash_profile and source ~/.bash_profile
export ANDROID_HOME=/Users/macbook/Library/Android/sdk/
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
This is working for me
Upvotes: 4
Reputation: 4639
First add these lines to your ~/.bashrc file:
export ANDROID_HOME=${HOME}/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
then:
source ~/.bashrc
Upvotes: 6
Reputation: 21
This is the issue because of you didn't give proper android sdk path variable in .bash_profile. for this you must follow the below steps.
1. Check android sdk path: for this you should open android studio->preferences and click on Android SDK in newly open window in that look for Android SDK location textfield in that you can find path of Android SDK. For me it shows like: /Users/<your_name>/Library/Android/sdk
. here <your_name>
is name of your home directory.
2. Open your terminal enter cd ~
command.
3. and enter vi .bash_profile
.
4. In vi editor enter following
export ANDROID_HOME=/Users/Murali/Library/Android/sdk
export PATH=$ANDROID_HOME/tools:$PATH
export PATH=$ANDROID_HOME/platform-tools:$PATH
Save it by press esc
button and enter :wq
.
5. After this close your terminal and open it again.
6. To apply all your changes in .bash_profile
enter following command
source .bash_profile
.
7. Enter android
command. Hope this now working fine :-)
Upvotes: 2
Reputation:
export PATH="/Users/me/Library/Android/sdk/platform-tools/":"/Users/me/Library/Android/sdk/tools/":$PATH
Worked for me
Upvotes: 4
Reputation: 4678
Problem Solved For Android Studio Users:
I am using Mac OS X Elcapitan version 10.11.X.
Under my home directory I found .bash_profile.save file. I opened that file using sublime (you can use any other editor). Then I added this line
export PATH=${PATH}:/Users/UserName/Library/Android/sdk/platform-tools:/Users/UserName/Library/Android/sdk/tools
Replace "UserName" with your UserName.
open terminal then run
source ~/.bash_profile
here you go.
Upvotes: 11
Reputation: 188
Update the path.
Open the Terminal program from Spotlight. Run the following command:
touch ~/.bash_profile; open ~/.bash_profile
Then save following code
export PATH=${PATH}:/android-sdk-macosx/platform-tools:/Development/android-sdk-macosx/tools
For my case, path is
export PATH=/Users/<user-name>/Development/android-sdk-macosx/platform-tools:/Users/<user-name>/Development/android-sdk-macosx/tools:$PATH
Save the file and quit the text editor. Execute your .bash_profile to update your PATH:
source ~/.bash_profile
Then run adb.
Upvotes: 2
Reputation: 231
I spent so much time trying to figure out, this steps helped me ( from http://docs.phonegap.com/en/2.2.0/guide_getting-started_android_index.md.html )
You need to execute your .bash_profile
to update your PATH
.
Open the Terminal program (this is in your Applications/Utilites folder by default). Run the following command
touch ~/.bash_profile; open ~/.bash_profile
This will open the file in the your default text editor. You need to add the path to your Android SDK platform-tools and tools directory. In my example I will use "/Development/android-sdk-macosx" as the directory the SDK is installed in. Add the following line:
export PATH=${PATH}:/Development/android-sdk-macosx/platform-tools:/Development/android-sdk-macosx/tools
Save the file and quit the text editor. Execute your .bash_profile
to update your PATH:
source ~/.bash_profile
Now every time you open the Terminal program you PATH
will included the Android SDK.
Upvotes: 23
Reputation: 20553
The android
tool is located in the tools
directory in your SDK. You need to add this to your PATH
environment variable so that bash can recognize it.
You can do this by adding it to your PATH
in your .bash_profile
file. This file should be located in your home directory. Create if it doesn't exist using vi .bash_profile
and add the following line to it:
export PATH=<path_to_android_sdk>/platform-tools:<path_to_android_sdk>/tools:$PATH
where <path_to_android_sdk>
is to be replaced with the path to your SDK. For example: "/Users/me/android-sdk-mac_86/platform-tools"
Upvotes: 89