gpt4 book ai didi

android - 由于 subant 错误,使用 Jenkins 构建 Android 测试项目失败

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:02:56 25 4
gpt4 key购买 nike

当我尝试在 Jenkins 上构建 Android 测试项目时,我收到以下错误消息:

BUILD FAILED
C:\Progra~1\android-sdk\tools\ant\build.xml:444: The
following error occurred while executing this line:
C:\Progra~1\android-sdk\tools\ant\build.xml:444: subant task calling
its own parent target.

这似乎是一个已知问题(https://code.google.com/p/android/issues/detail?id=21108https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=58917193)。据报道,这个问题实际上应该已经解决了,但我仍然面临所描述的问题。

我在 Windows 服务器上运行 Jenkins,安装了最新的 Android 工具(SDK 工具 v22.0.1,平台和构建工具 v17)并使用 Ant 1.9.0..

项目结构是:

  • 项目A
  • 项目A的测试项目

我在 Jenkins 上为他们两人创建了一个专门的构建工作。两个项目的 build.xml 文件都是使用“android update”命令创建的(如 Android 规范中所述)。所以他们都引用了 android-sdk/tools/ant 文件夹中的 build.xml。引用 subant ( http://ant.apache.org/manual/Tasks/subant.html ) 的 Apache Ant 规范,这可能是失败的根源?!

This task must not be used outside of a target if it invokes the same build file it is part of.

有没有人遇到过类似的问题?有什么解决办法吗?

预先感谢您的帮助。

最佳答案

"As reported, the issue should actually have been fixed, but I am still facing the described problem."

您提到的问题 ( issue 21108: Testing library project broken with SDK Tools r14 ) 尚未解决。这类似于 issue 21304: "ant debug installt" should work for test projects.这将不会被修复。

这里是 the workaround from Joe Bowbeer :

  1. ant.properties

    中删除tested.project.dir
  2. run-tests 目标添加到 build.xml:

    <!-- SDK Tools r15 workaround -->
    <property name="tested.manifest.package" value="com.example.test" />

    <target name="run-tests">
    <echo>Running tests...</echo>
    <exec executable="${adb}" failonerror="true">
    <arg line="${adb.device.arg}" />
    <arg value="shell" />
    <arg value="am" />
    <arg value="instrument" />
    <arg value="-w" />
    <arg value="${tested.manifest.package}/${test.runner}" />
    </exec>

  3. 使用命令行运行测试:

    $ ant debug install run-tests

换句话说,如果您使用一个单一的 installt 目标,您需要改变它。

关于android - 由于 subant 错误,使用 Jenkins 构建 Android 测试项目失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17593454/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com