How to set ANDROID_HOME path in ubuntu?

How to set ANDROID_HOME path in ubuntu?

Please provide the steps.


In the console just type these :

export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools

If you want to make it permanent just add those lines in the ~/.bashrc file


I would like to share an answer that also demonstrates approach using the Android SDK provided by the Ubuntu repository:

Install Android SDK

sudo apt-get install android-sdk

Export environmental variables

export ANDROID_HOME="/usr/lib/android-sdk/"
export PATH="${PATH}:${ANDROID_HOME}tools/:${ANDROID_HOME}platform-tools/"

Assuming you have the sdk extracted at ~/Android/Sdk,

export ANDROID_HOME=$HOME/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
  1. Add the above lines to the file ~/.bashrc (located at home/username/.bashrc) to make it permanent for the current user. Run source ~/.bashrc to apply the changes or restart your terminal.

    (or)

  2. Run the above lines on a terminal window to make it available for the session.


To test if you have set it up correctly,

Run the below commands on a terminal window

  1. echo $ANDROID_HOME

    user@host:~$ echo $ANDROID_HOME
    /home/<user>/Android/Sdk
    
  2. which android

    user@host:~$ which android
    /home/<user>/Android/Sdk/tools/android
    
  3. Run android on a terminal window, If it opens up Android SDK Manager, you are good to go.