简体   繁体   English

在ANT中执行“ android更新项目”失败,找不到sdkmanager.jar

[英]Executing `android update project` fails in ANT, can't find sdkmanager.jar

When trying to execute an android update on a project i am getting the following error. 尝试在项目上执行android更新时,出现以下错误。 Using linux. 使用linux。

Here is the ant code (where ${directory} is the directory of an android project): 这是蚂蚁代码(其中${directory}是android项目的目录):

<exec
    executable="/bin/bash"
    failonerror="true">
        <arg value="android"/>
        <arg value="update"/>
        <arg value="project"/>
        <arg value="-p"/>
        <arg value="${directory}"/>
</exec>

Here is the error: 这是错误:

[exec] android: can't find sdkmanager.jar

I have tried changing the permissions of sdkmanager.jar to 777 and it still gives the same error. 我尝试将sdkmanager.jar的权限sdkmanager.jar777 ,但仍然给出相同的错误。

When executing the same command from a bash or shell script it works fine. 从bash或shell脚本执行同一命令时,它可以正常工作。 And when running on the terminal it works fine. 并且在终端上运行时,它可以正常工作。

What is causing this problem and how can i fix it? 是什么导致此问题,我该如何解决?

If the script you are calling already contains the !/bin/sh at the top of the script you do not need to call the /bin/bash executable in the ant exec . 如果要调用的脚本已经在脚本顶部包含!/bin/sh ,则无需在ant exec调用/bin/bash可执行文件。

Therefore, if i change the code posted in the question to this... 因此,如果我将问题中发布的代码更改为此...

<exec
    executable="android"
    failonerror="true">
        <arg value="update"/>
        <arg value="project"/>
        <arg value="-p"/>
        <arg value="${directory}"/>
</exec>

... it works fine. ...效果很好。

Thanks, hope this helps someone in the future. 谢谢,希望这对以后的人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM