无法找到“ANDROID_HOME”环境变量。尝试设置手动设置 [英] Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually

查看:986
本文介绍了无法找到“ANDROID_HOME”环境变量。尝试设置手动设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力建立一个离子项目。我已经在ubuntu中建立了离子和android的环境。但是不知道为什么终端上显示以下错误...

 错误:找不到ANDROID_HOME环境变量失败。尝试设置手动设置。 
无法在您的PATH中找到android命令。尝试更新您的PATH以包含有效SDK目录的路径。

我已经设置了android家,如下...

  userPC:/ codes / myApp $ export ANDROID_HOME = / opt / android-sdk-linux 
userPC:/ codes / myApp $ export ANDROID_PLATFORM_TOOLS = / opt / android -sdk-linux / platform_tools
userPC:/ codes / myApp $ export ANDROID_TOOLS = / opt / android-sdk-linux / tools
userPC:/ codes / myApp $ PATH = $ PATH:$ ANDROID_HOME:$ ANDROID_TOOLS:$ ANDROID_PLATFORM_TOOLS

我的android-sdk-linux在/ opt /本身。从终端我可以运行 android 命令。所以,我觉得环境变量不是主要的问题。当我试图构建离子项目时,它显示无法找到ANDROID_HOME环境变量。我正在使用Android SDK Build Tools 22和离子最新版本。



任何人都可以告诉我如何解决这个问题?我搜索了很多,但到处都是我正确地设置android sdk和环境变量路径。但我已经设置了所有这些事情。谢谢!

解决方案

我认为你正在做的一切正确,除了 bin part.Add ANDROID_HOME环境变量路径并指出相应的bin目录为:

  1.export ANDROID_HOME = / path /到/ android / SDK 
2.export PATH = $ PATH:$ ANDROID_HOME / bin

当您在命令行上发出 studio.sh 命令时,将在包含可执行文件的路径中查找 bin目录 studio.sh 是这种情况下的一个。



有关详细信息,阅读此



希望这是有帮助的。


I am trying to build an ionic project. I have set up environment for ionic and android in ubuntu. But don't know why the following error is showing on terminal ...

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.

I have set up android home as followings ...

userPC:/codes/myApp$ export ANDROID_HOME=/opt/android-sdk-linux
userPC:/codes/myApp$ export ANDROID_PLATFORM_TOOLS=/opt/android-sdk-linux/platform_tools
userPC:/codes/myApp$ export ANDROID_TOOLS=/opt/android-sdk-linux/tools
userPC:/codes/myApp$ PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS

my android-sdk-linux is in /opt/ itself. From terminal I can run android command. So, I think environment variable is not the main issue. While I am trying to build ionic project, it shows Failed to find 'ANDROID_HOME' environment variable. I am using Android SDK Build Tools 22 and ionic latest version.

Can anyone tell me how can I solve this issue? I have searches a lot but everywhere I found to setup android sdk and environment variable path correctly. But I already have set up all these things. Thanks!

解决方案

I think you are doing everything right except for the bin part.Add ANDROID_HOME environment variable to path and point out the corresponding bin directory as:

1.export ANDROID_HOME=/path/to/android/SDK
2.export PATH=$PATH:$ANDROID_HOME/bin

when you issue studio.sh command on the command line, it looks for the bin directory in the path which contain executables! studio.sh is the one in this case.

For more information,Read this

Hope this was helpful.

这篇关于无法找到“ANDROID_HOME”环境变量。尝试设置手动设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆