Add $ANDROID_HOME to linux PATH
Error:
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 [c]echo $ANDROID_HOME[/c] 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
nano ~/.bash_profile
or if you want graphical editor then
gedit ~/.bash_profile
And add these
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
source ~/.bash_profile
To check if it worked run
echo $ANDROID_HOME
This should output the android sdk directory.
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
export PATH=$PATH:/opt/android-studio/gradle/<installed-gradle-version>/bin
Change the <installed-gradle-version> to the correct installed version
0 Comments