android - 无法创建任务或键入 checkenv 原因名称未定义

标签 android ant jenkins cordova jenkins-plugins

我知道有一些与此相关的问题,但我想做的有点不同。

我在项目配置选项中指定的 2 个目标是

干净 调试

默认情况下它们都可用,因此我不必为任何其他目标编写新代码。但我的构建仍然失败。

Started by user anonymous
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/jenkins-data/jobs/anttest1/workspace
Checkout:workspace / /var/lib/jenkins/jenkins-data/jobs/anttest1/workspace - hudson.remoting.LocalChannel@4603278f
Using strategy: Default
Last Built Revision: Revision 17b9fd2ee52d01e7a425822f353222445e3a82c7 (EventMatrix_Cordova_App/HEAD, EventMatrix_Cordova_App/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from EventMatrix_Cordova_App
Seen branch in repository EventMatrix_Cordova_App/HEAD
Seen branch in repository EventMatrix_Cordova_App/master
Commencing build of Revision 17b9fd2ee52d01e7a425822f353222445e3a82c7 (EventMatrix_Cordova_App/HEAD, EventMatrix_Cordova_App/master)
Checking out Revision 17b9fd2ee52d01e7a425822f353222445e3a82c7 (EventMatrix_Cordova_App/HEAD, EventMatrix_Cordova_App/master)
Warning : There are multiple branch changesets here
[mysteryshopper_version2] $ ant -file build.xml -Dlabel=anttest1-42 clean
Buildfile: /var/lib/jenkins/jenkins-data/jobs/anttest1/workspace/mysteryshopper_version2/build.xml
  **[taskdef] Could not load definitions from resource anttasks.properties. It could not be found.
  [taskdef] Could not load definitions from resource emma_ant.properties. It could not be found.**

-**check-env**:

BUILD FAILED
/usr/local/lib/android-sdk-linux/tools/ant/build.xml:392: Problem: **failed to create task or type checkenv**
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.


Total time: 0 seconds
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE

有人可以帮我解决这个问题吗??

最佳答案

<checkenv />是 Android 构建所必需的,它位于 Android SDK 目录的库中。我遇到了同样的问题,发现原因是 local.properties 中的错误目录build.xml 所需的文件和 buildAndroid.xml .这是我的样本 local.properties文件:

# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.

# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Users/myusername/android-sdk-macosx

当我在 Eclipse 中时,它会自动生成,但是当 Eclipse 关闭并且我在命令行中使用 ant 时,它没有更新并且有一些其他用户的信息已提交给 SVN,我检查了进行 svn 更新。

我将其更新为指向我自己的 Android SDK 目录,一切都开始工作了。

希望对您有所帮助!

关于android - 无法创建任务或键入 checkenv 原因名称未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17074286/

相关文章:

ant - 如何将文件集打印到文件中,每行一个文件名?

java - 使用 JUnit 的 ant 类路径编译问题

linux - Jenkins 和路径

performance - 将webpagetest.org 与 CI Jenkins 集成

java - Jenkins 插件版本 : Cannot see required configurations on Jenkins

javascript - 在android webview中为本地文件创建脚本标签时出现问题

android - 如何在 Android 上创建照片库?

android - 如何在 android 中生成 HMAC-SHA1 签名?

Android Jsoup如何获取这个元素

java - 部署时如何将 jar 文件包含在不同的包中