Could not create task or enter checkenv Cause Name undefined

I know that there are some questions related to this, but what I'm trying to do is a little different.

my 2 goals that I specified in my project configuration settings,

pure debug

both of them are available by default, so I do not need to write new code for any additional purposes. but my build still failed.

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 

Can someone help me?

+6
source share
3 answers

<checkenv /> is required to build Android, in the library in the Android SDK directory. I had the same problem and found that the reason was the bad directory in the local.properties file required by build.xml and buildAndroid.xml . Here is a sample of my local.properties file:

 # 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 

This is generated automatically when I am in Eclipse, but when Eclipse is closed and I work with ant on the command line, it was not updated and had some other user information that was passed to SVN and I checked with svn update.

I updated it by pointing to my own Android SDK directory and it all started.

Hope this helps!

+5
source

The problem is not with anttasks.properties or emma_ant.properties (at least for me). I fixed it differently. My build.xml target had the following lines

 <property file="local.properties"/> <property file="project.properties"/> <property file="ant.properties"/> 

Curiously, local.properties not in the build.xml folder, while the other two were present. Fortunately, I already had this because of my previous attempt with Android Studio, i.e. In StudioProjects/<my project>/local.properties . In other words, it is automatically created by Android Studio. If you do not have it, this is its content:

 ## 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 

So, you can create it yourself by specifying the paths of your SDK and, possibly, NDK.

Hope this helps.

+1
source

I had antbuild running when updating build tools, resulting in a file access conflict :) SDK Manager showed it as installed. When uninstalling and reinstalling, the problem is fixed.

0
source

Source: https://habr.com/ru/post/947154/


All Articles