java Ant 构建失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4605356/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ant failed to build
提问by eyal
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. My Android project has been built by using android create project command, using sdk 2.2. When I run my application for building the Android application I get the following message -
我已经构建了一个 Java 应用程序,它使用 ant.jar (ant 1.8.2) 类从它的 build.xml 文件中构建 android 应用程序,并将发布作为目标。我的 Android 项目是使用 android create project 命令构建的,使用 sdk 2.2。当我运行我的应用程序来构建 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.
谢谢,埃亚尔。
采纳答案by jmort253
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" *
回答by trojanfoe
You need to update the project:
您需要更新项目:
android update project --path .
回答by Nick Burton
I had this problem and realised the build.xml file was old. Try creating a new project and make sure you've got the most up-to-date build.xml file (with the new imports, etc). Good luck.
我遇到了这个问题并意识到 build.xml 文件很旧。尝试创建一个新项目并确保您拥有最新的 build.xml 文件(包含新的导入等)。祝你好运。
回答by Valdez V.
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\tools\proguard\lib\proguard.jar
After that I managed to compile further.
之后我设法进一步编译。