Ionic android build错误 - 无法找到“ANDROID_HOME”环境变量 [英] Ionic android build Error - Failed to find 'ANDROID_HOME' environment variable
问题描述
我试图在linux中构建android的离子,但它显示我一个错误这样
[错误:找到ANDROID_HOME环境变量。
尝试手动设置。
无法在PATH中找到android命令。
尝试更新您的PATH以包括有效的SDK目录的路径。]
构建平台之一的错误:错误:/ home / kumar / myapp / platforms / android / cordova / build:退出代码2
您可能没有构建此项目所需的环境或操作系统
错误:/ home / kumar / myapp / platforms / android / cordova / build:命令失败,退出代码2
在ChildProcess.whenDone(/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
在ChildProcess.EventEmitter.emit(events.js: 98:17)
at maybeClose(child_process.js:743:16)
在Process.ChildProcess._handle.onexit(child_process.js:810:5)
$ b $ c> export ANT_HOME =/ usr / bin / ant
export PATH =$ PATH:$ ANT_HOME / bin
export HOME =/ home / kumar
export ANDROID_HOME = $ HOME / android-sdk-linux / tools
export ANDROID_PLATFORM_TOOLS =$ HOME / android-sdk-linux / platform-tools
export PATH =$ ANDROID_HOME:$ ANDROID_PLATFORM_TOOLS:$ PATH
我想我已经给了路径,但我不知道为什么它显示我这个错误。 。请帮助....
Android Home应该是SDK的根文件夹。
export ANDROID_HOME =$ HOME / android-sdk-linux
pre>
EDIT :打开终端并键入这些命令。 (是,在ternimal,不在bashrc文件中)
export ANDROID_HOME =〜/ android-sdk-macosx
PATH = $ PATH:$ ANDROID_HOME / tools
PATH = $ PATH:$ ANDROID_HOME / platform-tools
然后在同一个终端只需键入
android
。如果配置,您将能够使用从此终端的构建命令。 (这是一个临时解决方案)I am trying to build android for ionic in linux but its showing me an error like this
[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.] ERROR building one of the platforms: Error: /home/kumar/myapp/platforms/android/cordova/build: Command failed with exit code 2 You may not have the required environment or OS to build this project Error: /home/kumar/myapp/platforms/android/cordova/build: Command failed with exit code 2 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23) at ChildProcess.EventEmitter.emit (events.js:98:17) at maybeClose (child_process.js:743:16) at Process.ChildProcess._handle.onexit (child_process.js:810:5)
and i've added this in my bashrc file
export ANT_HOME="/usr/bin/ant" export PATH="$PATH:$ANT_HOME/bin" export HOME="/home/kumar" export ANDROID_HOME="$HOME/android-sdk-linux/tools" export ANDROID_PLATFORM_TOOLS="$HOME/android-sdk-linux/platform-tools" export PATH="$ANDROID_HOME:$ANDROID_PLATFORM_TOOLS:$PATH"
I'm thinking i've given the path but i dont know why its showing me this error .. Please help....
解决方案Android Home should be the root folder of SDK.
export ANDROID_HOME="$HOME/android-sdk-linux"
EDIT: Open terminal and type these commands. (yes, on a ternimal , not in bashrc file)
export ANDROID_HOME=~/android-sdk-macosx PATH=$PATH:$ANDROID_HOME/tools PATH=$PATH:$ANDROID_HOME/platform-tools
and then in the same terminal just type
android
. If configured you would be able to use build commands from this terminal. (it's a temporary solution)这篇关于Ionic android build错误 - 无法找到“ANDROID_HOME”环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!