Android SDK 26以后ant编译错误解决办法(错误信息:taskdef A class needed by class com.android.ant.GetUiTargetTask)

问题现象:

build.xml:475: taskdef A class needed by class com.android.ant.GetUiTargetTask cannot be found: com/android/utils/ILogger
 using the classloader AntClassLoader[/usr/local/androidsdk/tools/lib/ant-tasks.jar:/usr/local/androidsdk/tools/lib/kxml2-2.3.0.jar:/usr/local/androidsdk/tools/lib/httpmime-4.1.jar:/usr/local/androidsdk/tools/lib/annotations-12.0.jar:/usr/local/androidsdk/tools/lib/commons-logging-1.1.1.jar]

Android SDK 26以后ant编译错误解决办法(错误信息:taskdef A class needed by class com.android.ant.GetUiTargetTask)_第1张图片

问题原因及解决方法:

AndroidSDK26版本以后删除了ant编译相关的组件,如有需要可以手动复制添加对应文件,配置如下:

tools/ant/*
tools/lib/ant-tasks.jar
tools/lib/common.jar
tools/lib/sdklib.jar
tools/lib/guava-17.0.jar
tools/lib/manifest-merger.jar

 

验证重新编译即可通过

以上文件我整理一份附件贴到这里,审核通过后贴上链接,文件来源android-sdk_r24.4.1-linux

https://download.csdn.net/download/xlyrh/12683071

 

问题参考链接:

https://stackoverflow.com/questions/42577491/taskdef-a-class-needed-by-class-com-android-ant-getuitargettask-cannot-be-found/43337226

你可能感兴趣的:(studio,android,ant,androidsdk)