Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.android.ant.NewSetupTask not found error after upgrade to SDK v20 tools

Tags:

sdk

ant

After upgrading to the v20 SDK tools, I am receiving this error when attempting to run my Ant build.

The sdk.dir property is correct and verified (adding to output in build.xml). Unpacking anttasks.jar it seems that the NewSetupTask is truly missing in the latest tools.

META-INF/
META-INF/MANIFEST.MF
com/
com/android/
com/android/ant/
com/android/ant/RenderScriptTask.class
com/android/ant/SingleDependencyTask$1.class
com/android/ant/PropertyByReplaceTask.class
com/android/ant/BuildTypedTask.class
com/android/ant/AaptExecTask$1.class
com/android/ant/AaptExecTask$ResFolderInputPath.class
com/android/ant/AaptExecTask$NoCompress.class
com/android/ant/ApkBuilderTask.class
com/android/ant/GetLibraryPathTask.class
com/android/ant/InputPath.class
com/android/ant/RenderScriptTask$OptLevel.class
com/android/ant/TaskHelper.class
com/android/ant/XPathTask.class
com/android/ant/ManifestMergerTask.class
com/android/ant/DependencyHelper$LibraryProcessor.class
com/android/ant/CheckEnvTask.class
com/android/ant/RenderScriptTask$1.class
com/android/ant/ApkBuilderTask$SourceFolderInputPath.class
com/android/ant/DependencyHelper$JarProcessor$1.class
com/android/ant/ComputeDependencyTask.class
com/android/ant/SingleInputOutputTask.class
com/android/ant/GetLibraryPathTask$1.class
com/android/ant/RenderScriptTask$RenderScriptProcessor.class
com/android/ant/SignApkTask.class
com/android/ant/DependencyHelper$JarProcessor.class
com/android/ant/SignApkTask$NullZipFilter.class
com/android/ant/DependencyHelper$AdvancedLibraryProcessor.class
com/android/ant/DependencyGraph.class
com/android/ant/ComputeDependencyTask$1.class
com/android/ant/DexExecTask.class
com/android/ant/MultiFilesTask.class
com/android/ant/AidlExecTask$1.class
com/android/ant/DependencyHelper.class
com/android/ant/AidlExecTask.class
com/android/ant/BuildConfigTask.class
com/android/ant/ApkBuilderTask$1.class
com/android/ant/AaptExecTask.class
com/android/ant/SingleDependencyTask.class
com/android/ant/DependencyGraph$1.class
com/android/ant/ZipAlignTask.class
com/android/ant/GetTypeTask.class
com/android/ant/GetEmmaFilterTask.class
com/android/ant/IfElseTask.class
com/android/ant/DependencyGraph$DependencyStatus.class
com/android/ant/AidlExecTask$AidlProcessor.class
com/android/ant/ComputeProjectClasspathTask.class
com/android/ant/SingleDependencyTask$InputPathFactory.class
com/android/ant/GetTargetTask$1.class
com/android/ant/MultiFilesTask$DisplayType.class
com/android/ant/MultiFilesTask$SourceProcessor.class
com/android/ant/GetProjectPathsTask.class
com/android/ant/SignApkTask$1.class
com/android/ant/GetTargetTask.class
com/android/ant/ComputeDependencyTask$2.class
com/android/ant/GetLibraryPathTask$LeafProcessor.class
anttasks.properties

Where'd it go?

like image 820
Douglas Hill Avatar asked Jan 17 '23 02:01

Douglas Hill


1 Answers

The problem stems from the fact that I am using a fully customized build.xml file. As such, it contains the following custom ant task definitions:

<taskdef name="setup"
    classname="com.android.ant.NewSetupTask"
    classpathref="android.antlibs" />

<taskdef name="aapt"
    classname="com.android.ant.AaptExecTask"
    classpathref="android.antlibs" />

<taskdef name="aidl"
    classname="com.android.ant.AidlExecTask"
    classpathref="android.antlibs" />

<taskdef name="renderscript"
    classname="com.android.ant.RenderScriptTask"
    classpathref="android.antlibs" />

<taskdef name="dex"
    classname="com.android.ant.DexExecTask"
    classpathref="android.antlibs" />

<taskdef name="apkbuilder"
    classname="com.android.ant.ApkBuilderTask"
    classpathref="android.antlibs" />

<taskdef name="zipalign"
    classname="com.android.ant.ZipAlignTask"
    classpathref="android.antlibs" />

<taskdef name="xpath"
    classname="com.android.ant.XPathTask"
    classpathref="android.antlibs" />

<taskdef name="if"
    classname="com.android.ant.IfElseTask"
    classpathref="android.antlibs" />

One or more of these are no longer provided by the anttasks.jar library. In comparing my build.xml file with the one located {sdk.dir}/tools/ant/build.xml I notice that these definitions have been replaced with the following:

<taskdef resource="anttasks.properties" classpathref="android.antlibs" />

Replacing the old task defs. in my build.xml file with this new task def statement removes the reference to missing tasks and fixes my problem.

like image 144
Douglas Hill Avatar answered Apr 08 '23 02:04

Douglas Hill