我知道有一些与此相关的问题,但我想做的是有点不同。
我在项目配置选项中指定的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目录中的库中。我有同样的问题,发现原因是build.xml
和buildAndroid.xml
所需的local.properties
文件中的坏目录。以下是我的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目录,一切都开始工作了。
希望有帮助!
问题不在于anttasks.properties
或emma_ant.properties
(至少对我来说)。我用不同的方法修复了它。我的目标build.xml
有这些行
<property file="local.properties"/>
<property file="project.properties"/>
<property file="ant.properties"/>
奇怪的是,local.properties
从build.xml
文件夹中消失了,而其他两个文件夹却出现了。幸运的是,我已经有了它,因为我以前的尝试与Android工作室,即在StudioProjects/<my project>/local.properties
。换句话说,它是由Android Studio自动创建的。如果你没有,这是它的内容:
## This file is automatically generated by Android Studio.
# 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 Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Fri Apr 22 21:28:15 EEST 2016
ndk.dir=home/<user>/android-ndk-r11c
sdk.dir=home/<user>/Android/Sdk
你基本上可以自己创建它指定你的SDK和NDK的路径
我在更新构建工具时运行了一个antbuild,导致文件访问冲突:)SDK管理器显示它已安装。删除并重新安装修复了这个问题。