错误:无法找到“ANDROID_HOME”环境变量

时间:2016-03-27 15:46:36

标签: android cordova ionic-framework

当我运行离子应用程序时,我得到android主页设置错误。这是我的完整命令及其输出

sudo ionic run android

Running command: /home/manish/do_practice/ionic/hooks/after_prepare/010_add_platform_class.js /home/manish/do_practice/ionic
add to body class: platform-android
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.

这是我的~/.bashrc文件条目

export ANDROID_HOME=/home/manish/Android/Sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools

这里是echo命令

echo $ANDROID_HOME
/home/manish/Android/Sdk
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/manish/Android/Sdk/tools:/home/manish/Android/Sdk/platform-tools

3 个答案:

答案 0 :(得分:0)

请使用以下命令重新加载bashrc

source ~/.bashrc

答案 1 :(得分:0)

"建立工具" PATH中缺少目录。删除"导出"你的.bashrc文件中的行并复制它:

export PATH=$PATH:/home/manish/Android/Sdk/platform-tools:/home/manish/Android/Sdk/tools:/home/manish/Android/Sdk/build-tools

答案 2 :(得分:0)

尝试设置工具,尝试下面的代码,编辑这个android sdk路径到你的,

export ANDROID_HOME=/Users/Mac/Desktop/mac/android-sdk-macosx
PATH=$PATH:$ANDRIOD_HOME/tools
PATH=$PATH:$ANDRIOD_HOME/platform-tools