ANDROID_HOME environment variable

21,793

Here's an excerpt based on https://help.ubuntu.com/community/AndroidSDK

Modifying the PATH Environment Variable

In the days before Android 2.2, a good number of people used to place their various projects and applications in the directories where the necessary tools they used existed. This was in itself a very flawed method because it cluttered up the directories, and while cleaning up the SDK, one might accidentally delete a crucial file, which will cause the SDK to fail and having to completely reinstall everything.

Modifying the PATH Environment Variable will help out immensely when it comes down to making use of SDK tools like ADB. Doing this will also allow you to execute certain protocols like ADB from ANY location. So if you're operating from the Desktop, you don't have to redirect to the SDK's platform-tools folder to make use of ADB if you need to make use of it.

As you know, 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.

Edit: you may have to login and back out again in order for your changes to take effect (~/.bashrc reloaded). For more on bash startup files see this

I believe this will solve your problem.

Share:
21,793

Related videos on Youtube

Theodore Tremblot
Author by

Theodore Tremblot

Updated on September 18, 2022

Comments

  • Theodore Tremblot
    Theodore Tremblot over 1 year

    I know that there are several questions similar to this one but I have been trying different solutions for the past 3 days and none of them seem to work. I am trying to start a new project on ionic (an android project obviously) and I get the below errors:

    Error: 'ANDROID_HOME' environment variable is et to non-existent path: /Home/Android/Sdk
    Try update it manually to point to valid SDK directory.
    

    When I echo to see where the ANDROID_HOMEvariable is, it returns: /Home/Android/Sdk. I have tried to manually set the path permanently by opening the .bashrc file (by hitting CTRL H on Home) and at the end of the .bashrc file I typed: export ANDROID_HOME=$HOME/Android/Sdk export PATH=$PATH:$ANDROID_HOME/tools. I made sure to save the .bashrc file too.

  • Theodore Tremblot
    Theodore Tremblot about 7 years
    I tried what you suggested and the same error occurred. Error: 'ANDROID_HOME' environment variable is et to non-existent path: /Home/Android/Sdk. I believe it's because the path entered directly in the nano document isn't the same as the one that was entered directly in the terminal?
  • Theodore Tremblot
    Theodore Tremblot about 7 years
    I also remembered to save the changes made so saving isn't the problem.
  • Elder Geek
    Elder Geek about 7 years
    Edited answer. The reason you are getting the error you mention in your comment is described in the error on top of being the wrong path, the path doesn't exist. I hope this help.