nilkash
nilkash

Reputation: 7536

Android command not found even PATH set

hi i am using ubuntu 12.04. and in ~/.bashrc file I set following things

export ANDROID_HOME=/home/nilkash/Downloads/android-sdk-linux/platform-tools

But still it gives me android: command not found error. how to set path for android. Need Help. Thank you.

Upvotes: 8

Views: 29212

Answers (6)

Amit Gupta
Amit Gupta

Reputation: 8939

To include the SDK's tools and platform-tools directories in your PATH environment open text editor to create or modify the ~/.bash_profile file, adding below line:

export PATH=${PATH}:/home/nilkash/Downloads/android-sdk-linux/platform-tools:/home/nilkash/Downloads/android-sdk-linux/tools

For Ubuntu:

To modify the PATH variable of your system, you need to edit your .bashrc file. To do so, in a terminal, execute the following command:

$ nano ~/.bashrc

You will now have the Nano text editor enabled on the terminal. Now, at the very top of the file, enter the following:

#AndroidDev PATH
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools

Once you're finished, press CTRL + X, Y, and then hit Enter to save your changes and exit the Nano text editor.

To reload the ~/.bashrc without re log in:

. ~/.bashrc or source ~/.bashrc

References:
- help.ubuntu.com/community/AndroidSDK
- How do I reload .bashrc without logging out and back in?

Upvotes: 17

Ivan
Ivan

Reputation: 3062

android: command not found error

Solution for Linux and Mac:

1) Export your Android Sdk path to the ANDROID_HOME variable

$ export ANDROID_HOME=~/Android/Sdk (where ~/Android/Sdk is a full path to your Sdk folder)

(change "~" to "$HOME" on Mac)

2) Export Sdk tools to the PATH variable

$ export PATH=$ANDROID_HOME/tools:$PATH

That's it!

Upvotes: 4

P-RAD
P-RAD

Reputation: 1341

I tried

sudo nano /etc/profile

and appended these after the fi export JAVA_HOME=/usr/lib/jvm/java-8-oracle export ANDROID_HOME=/home/dev/Android/Sdk export PATH=$PATH:$JAVA_HOME/bin:$ANDROID_HOME/platform-tools:ANDROID_HOME/tools export JAVA_HOME export ANDROID_HOME

and after saving the file

exec bash

these got my android command working, I had set PATH in .bashrc which was not working for me

Hope It'll help somebody

Upvotes: 1

Khaled Awad
Khaled Awad

Reputation: 1814

if the problem still exist please make sure that you have the right permissions try sudo chmod -R 777 /home/your-user-name/.cordova/

Also make sure that you are NOT using sudo to add Android as a platform

This is incorrect in the default Cordova installation
sudo cordova platform add android

Just do cordova platform add android

Upvotes: 0

vladymy
vladymy

Reputation: 382

1) Check in System Settings -> Details, whether your Ubuntu is 32-bit or 64-bit

2) If your Ubuntu is a 32-bit OS then run this sudo apt-get install libgl1-mesa-dev In case of 64-bit OS run this sudo apt-get install ia32-libs

3) run this sudo apt-get install openjdk-6-jdk or better this sudo apt-get install openjdk-7-jdk

4) Download SDK platform tools from here http://developer.android.com/sdk/index.html

5) Unzip downloaded file "adt-bundle-linux-x86_64-20131030.zip" (you can have a little bit different name ;). But you should get folder contained two sub folder - sdk and eclipse

6) Run this nautilus ~

7) In opened window create folder 'android-sdk-linux'

8) copy the all entire contents of folder sdk (from unzipped archive) to this new folder 'android-sdk-linux'

9) try run this cd ~/android-sdk-linux/tools then this ./android. If you did all right you should see Android SDK Manager

10) run this sudo gedit ~/.bashrc in opened editor add this in very top

#AndroidDev PATH
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools

11) save and close

12) run exec bash then try run android

13) give write permissions to android-sdk-linux folder

Enjoy! ;)

Upvotes: 11

Zax
Zax

Reputation: 3010

Environment variables can be defined permanently by editing the .profile file in your home directory. Here's how:

Edit your .profile file with a command like gedit ~/.profile. Append this to the end of the file:

export ANDROID_SDK_HOME=/home/nilkash/Downloads/android-sdk-linux/platform-tools

You can source .profile to make it apply right away. Each time you restart your system, the .profile file is loaded, restoring this setting.

OR

This below method works 100% for me on Ubuntu 12.04:

  • Start the terminal

  • $gedit .bashrc

  • Add the below line at the enc of the file:

    PATH=$PATH:/home/nilkash/Downloads/android-sdk-linux/platform-tools/

Note: gedit must be performed only on .bashrc and NOT on .bashrc~

Please do accept the answer if it works for you.

Upvotes: 0

Related Questions