gpt4 book ai didi

android - 在 linux 下从 jenkins 构建 android 项目 - 构建失败,找不到导入的 build.xml

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:31:36 26 4
gpt4 key购买 nike

我正在尝试从 Jenkins 构建简单的 android 项目,但构建失败并输出消息(详细):

Building in workspace /var/lib/jenkins/jobs/MyProj/workspace
[MyProj] $ ant -file build.xml help -v
Apache Ant version 1.8.1 compiled on October 13 2010
Buildfile: /home/ramps/MyProj/build.xml
Detected Java version: 1.6 in: /usr/lib/jvm/java-6-openjdk/jre
Detected OS: Linux
parsing buildfile /home/ramps/MyProj/build.xml with URI = file:/home/ramps/MyProj/build.xml
Project base dir set to: /home/ramps/MyProj
parsing buildfile jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
[property] Loading /home/ramps/MyProj/local.properties
[property] Loading /home/ramps/MyProj/ant.properties
Importing file /home/ramps/MyProj/custom_rules.xml from /home/ramps/MyProj/build.xml
Cannot find /home/ramps/MyProj/custom_rules.xml imported from /home/ramps/MyProj/build.xml
Importing file /usr/share/android-sdk-linux/tools/ant/build.xml from /home/ramps/MyProj/build.xml

BUILD FAILED
/home/ramps/MyProj/build.xml:81: Cannot find /usr/share/android-sdk-linux/tools/ant/build.xml imported from /home/ramps/MyProj/build.xml
at org.apache.tools.ant.taskdefs.ImportTask.importResource(ImportTask.java:181)
at org.apache.tools.ant.taskdefs.ImportTask.execute(ImportTask.java:162)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:179)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82)
at org.apache.tools.ant.Main.runBuild(Main.java:786)
at org.apache.tools.ant.Main.startAnt(Main.java:218)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
  • MyProj 是一个干净的项目,通过以下方式创建:

    android 创建项目 --name MyProj --package com.myproj --target "android-15"--path MyProj --activity MyProj

  • 当然文件“/usr/share/android-sdk-linux/tools/ant/build.xml”存在。

  • shell 中的“ant help”运行良好。
  • local.properties 包含 android SDK 的有效路径:

    sdk.dir=/usr/share/android-sdk-linux

知道为什么 MyProj/build.xml 找不到“/usr/share/android-sdk-linux/tools/ant/build.xml”吗?

最佳答案

好的,我设法解决了它。用户 jenkins 无权进入 android-sdk-linux 文件夹。

通常,在调试此类问题时,尝试手动执行 Jenkins 正在执行的操作非常有帮助:

$sudo su jenkins

现在,当 jenkins 用户尝试输入文件夹、创建新文件夹等时。

关于android - 在 linux 下从 jenkins 构建 android 项目 - 构建失败,找不到导入的 build.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10860777/

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