未设置ANDROID_HOME(在OS X上作为服务运行的VSTS代理) [英] ANDROID_HOME not set (VSTS agent running as service on OS X)
问题描述
我已经在MacBook Pro上配置了VSTS代理,当我手动运行它(使用./run.sh
)时,它可以完美运行.
I have configured the VSTS agent on my MacBook Pro and it works perfectly when I manually run it (using ./run.sh
).
但是,当我将VSTS代理配置为作为服务运行(使用./svc.sh install
和./svc.sh start
)并在VSTS中对新版本进行排队时,我收到错误消息(在签名步骤上)未设置ANDROID_HOME".
However when I configure the VSTS agent to run as a service (using ./svc.sh install
and ./svc.sh start
) and queue a new build in VSTS I receive an error (on the signing step) "ANDROID_HOME not set".
我在.bash_profile中配置了以下内容:
I have the following configured in my .bash_profile:
export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
路径正确,并且运行echo $ANDROID_HOME
也会返回预期值(在本例中为/Users/mvanbeusekom/Library/Android/sdk
).
The path is correct and also running echo $ANDROID_HOME
returns the expected value (in this case /Users/mvanbeusekom/Library/Android/sdk
).
有人知道怎么了吗?
推荐答案
在您的代理文件夹中,有一个名为runsvc.sh的文件.在其中添加导出.您会看到一条注释掉的行,提示您将环境设置放在何处:
In your agent folder, there is a file named runsvc.sh. Add your export in there. You'll see a commented-out line prompting you where to put your env setup:
# insert anything to setup env when running as a service
export ANDROID_HOME=/Users/$(whoami)/Library/Android/sdk
请确保重新启动服务.
.bash_profile
对您不起作用的原因是因为该服务在运行时无法访问它.
The reason .bash_profile
doesn't work for you is because the service doesn't have access to that when it runs.
我遇到了同样的问题,并在这里找到了解决方案: https://github.com/Microsoft/vsts-tasks/issues/1726#issuecomment-219725321
I had the same problem and found the solution here: https://github.com/Microsoft/vsts-tasks/issues/1726#issuecomment-219725321
对于那些使用Xamarin开发的人,通常会需要它:
For those developing with Xamarin, you'll typically need this instead:
# insert anything to setup env when running as a service
export ANDROID_HOME=/Users/$(whoami)/Library/Developer/Xamarin/android-sdk-macosx
这篇关于未设置ANDROID_HOME(在OS X上作为服务运行的VSTS代理)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!