且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法找到“ANDROID_HOME”环境变量。尝试设置手动设置

更新时间:2022-10-16 15:47:19

我认为你正在做的一切正确,除了 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.