在Ubuntu中找不到“ ANDROID_HOME”环境变量

时间:2018-08-28 12:20:24

标签: android cordova ionic-framework ionic3

You have been opted out of telemetry. To change this, run: cordova telemetry on.
(node:5862) UnhandledPromiseRejectionWarning: CordovaError: 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.

当我尝试在Ionic中构建时,我遇到了这个问题。 来自我的~/.bashrc

  export HOME=home/fabrica
  export ANDROID_HOME=$HOME/Android/Sdk
  export PATH=$ANDROID_HOME/tools:$PATH
  export PATH=$ANDROID_HOME/platform-tools:$PATH
  export PATH=$ANDROID_HOME/build-tools:$PATH
  

$ echo $ PATH

将显示此

home/fabrica/Android/Sdk/build-tools:home/fabrica/Android/Sdk/platform-tools:home/fabrica/Android/Sdk/tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin:/home/fabrica//Android/Sdk/tools:/home/fabrica//Android/Sdk/platform-tools:/home/fabrica///Android/Sdk/tools:/home/fabrica///Android/Sdk/platform-tools

1 个答案:

答案 0 :(得分:0)

首先,您可以删除遥测错误第一行上的警告

cordova遥测收集科尔多瓦开发团队的科尔多瓦使用情况的开发人员数据。

您可以通过以下方式从cordova cli (cli reference)打开/关闭:

cordova telemetry on
cordova telemetry off