简体   繁体   English

Ant无法构建

[英]Ant failed to build

I have build a Java appliction which is using ant.jar (ant 1.8.2) classes for building android application from it's build.xml file with release as target. 我已经构建了一个Java应用程序,它使用ant.jar(ant 1.8.2)类从它的build.xml文件构建android应用程序,并将release作为目标。 My Android project has been built by using android create project command, using sdk 2.2. 我的Android项目是使用android create project命令构建的,使用sdk 2.2。 When I run my application for building the Android application I get the following message - 当我运行构建Android应用程序的应用程序时,我收到以下消息 -

build.xml:46: taskdef class com.android.ant.SetupTask cannot be found build.xml:46:无法找到taskdef类com.android.ant.SetupTask

I have verified the sdk.dir path and the sdk-location path and both are correct. 我已经验证了sdk.dir路径和sdk-location路径,两者都是正确的。

How it can be solved? 如何解决?

Thanks, Eyal. 谢谢,Eyal。

您需要更新项目:

android update project --path .

Have you verified that the com.android.ant.SetupTask class is indeed in the sdk.dir and sdk-location path that you define? 您是否验证过com.android.ant.SetupTask类确实位于您定义的sdk.dir和sdk-location路径中?

If on Linux, the following command, run at the root of those directories, can tell you if the class is found by looking in all class and JAR files: 如果在Linux上,在这些目录的根目录下运行的以下命令可以通过查看所有类和JAR文件来告诉您是否找到了该类:

   grep -ri "com.android.ant.SetupTask" *

I had this problem and realised the build.xml file was old. 我有这个问题,并意识到build.xml文件是旧的。 Try creating a new project and make sure you've got the most up-to-date build.xml file (with the new imports, etc). 尝试创建一个新项目,并确保您拥有最新的build.xml文件(使用新的导入等)。 Good luck. 祝好运。

In a Windows Vista box, I solved that by updating the following line in the "build.properties" file located at zxing root directory: 在Windows Vista框中,我通过更新位于zxing根目录的“build.properties”文件中的以下行来解决这个问题:

android-home=[YOUR PATH HERE] android-home = [你的路径在这里]

...after that one, I had another error about "proguard.jar", which I also had to point to the correct location: ...在那之后,我有另一个关于“proguard.jar”的错误,我还必须指向正确的位置:

proguard-jar=C:\\android_sdk\\tools\\proguard\\lib\\proguard.jar ProGuard的-JAR = C:\\ android_sdk \\工具\\ proguard的\\ LIB \\ proguard.jar

After that I managed to compile further. 之后我设法进一步编译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM