ANDROID_HOME Linux Environment Variable

Asked

Viewed 13,343 times

2

I am having problem with the environment variable ANDROID_HOME, whenever I try to run the command to run an app in the emulator (or mobile connected), this error message appears

Error: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.

I’ve tried a lot of things I’ve seen on the Internet and nothing’s worked, can anyone help me? I’m using Deepin Linux.

When executing echo $ANDROID_HOME the result is /home/rafael/Android/Sdk

When I give echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/home/rafael/bin:/usr/local/java/jdk1.8.0_131/bin:/home/rafael/Android/Sdk/tools:/home/rafael/Android/Sdk/platform-tools:/home/rafael/Android/Sdk/tools:/home/rafael/Android/Sdk/platform-tools
  • 2

    Possible duplicate of https://answall.com/q/49847/3635 and https://answall.com/q/176032/3635

1 answer

6


It is necessary to rotate the commands:

sudo gedit ~/.bashrc

In this file you need to add the following commands:


export ANDROID_HOME=caminho_do_SDK
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

Save and reload the.bashrc file:

source ~/.bashrc
  • 1

    It still didn’t work, I put in the file as you said, but the same error. I updated the post to see what happens when I echo into $PATH

  • 1

    do not use sudo to edit the user file. this will block permissions for root.

  • 1

    I logged in just to thank, best solution I could find... :)

  • I have the same problem but with Centos 7, I did everything it says here and nothing worked.

  • 1

    In my case I put the EXPORT on ~/. zshrc

Browser other questions tagged

You are not signed in. Login or sign up in order to post.