Add $ANDROID_HOME to linux PATH

This section is for our team to post helpful articles. Let us know if you'd like to contribute!
arifur
Site Admin
Posts: 107
Joined: Tue Nov 15, 2011 5:12 pm

Add $ANDROID_HOME to linux PATH

Post by arifur » Mon May 15, 2017 11:48 am

Error:

Code: Select all

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.
Solution:
Adding android sdk to the PATH

Open Terminal and run echo $ANDROID_HOME to view the current Android Home Path if any.
If it returns a directory make sure it is infact the correct android sdk directory.
If it does not return anything then open terminal and type

Code: Select all

nano ~/.bash_profile
or if you want graphical editor then

Code: Select all

gedit ~/.bash_profile 
And add these

Code: Select all

export ANDROID_HOME='/home/<user_name>/Android/Sdk' <Path to android SDK>
export PATH=$PATH:$ANDROID_HOME/bin
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/platform-tools
** Make sure the change the ANDROID_HOME to the correct directory

Then run this command for the changes to take effect

Code: Select all

source ~/.bash_profile
To check if it worked run

Code: Select all

echo $ANDROID_HOME
This should output the android sdk directory.

arifur
Site Admin
Posts: 107
Joined: Tue Nov 15, 2011 5:12 pm

Re: Add GRADLE to linux PATH

Post by arifur » Mon May 15, 2017 11:55 am

If you want to use cordova then you may have to add Gradle to the PATH too. If you have Android Studio installed then gradle will also be installed. You can use that version or you can install it separately.

Simply add this line to add Grade to the PATH

Code: Select all

export PATH=$PATH:/opt/android-studio/gradle/<installed-gradle-version>/bin
Change the <installed-gradle-version> to the correct installed version

Post Reply Previous topicNext topic

Return to “Linux Howtos”

Who is online

Users browsing this forum: No registered users and 1 guest