AFS
AFS

Reputation: 1443

Failed to find 'ANDROID_HOME' environment variable

When I type sudo ionic build android I get this 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.

and I have the following lines on .bashrc

export ANDROID_HOME=~/Android
export PATH=$PATH:$ANDROID_HOME:~/Android/Sdk/tools:~/Android/Sdk/platform-tools:~/node/bin

and the android command work con the console.

EDIT:

This is now my .bashrc file

export ANDROID_HOME="~/Android/Sdk"
export PATH="$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:~/node/bin"

I still fails the same way

I have to execute sudo ionic build android or I get :

Error: EACCES: permission denied, open '/home/user/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.

Upvotes: 0

Views: 585

Answers (1)

user6032296
user6032296

Reputation:

If you have installed ionic globally, you should not call sudo. Just execute:

ionic build android

And I think your ANDROID_HOME should be set to ~/Android/Sdk. Here is my environment variable for android sdk that you may read just for reference:

ANDROID_HOME="~/Android/android-sdk-macosx"
PATH="${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${PATH}"
export ANDROID_HOME PATH

Upvotes: 2

Related Questions