Ant failed to build on Ubuntu

你离开我真会死。 提交于 2019-12-09 23:55:51

问题


I hope someone can help me out with this problem. I am using an Ant Build to compile my java code but I get the following errors:

Buildfile: <PATH>

BUILD FAILED
<PATH>build.xml:55: sdk.dir is missing. Make sure 
    to generate local.properties using 'android update project' or to inject it
    through the ANDROID_HOME environment variable.

Total time: 345 milliseconds

I am using eclipse.


回答1:


There are two solutions to this problem, as described in the error message:

  1. Set the value of the sdk.dir variable in the local.properties file in the root directory of your Android project. This needs to point to the location of your Android SDK installation. For example, I have the following line in mine:

    sdk.dir=/usr/local/bin/android-sdk-linux

    You can do this manually or use the android update project command to generate it for you.

  2. Alternatively, you can set the ANDROID_HOME environment variable in your .bashrc file in your home directory. You can do this by adding something like the following line:

    export ANDROID_HOME=/usr/local/bin/android-sdk-linux

    Note that you will need to source your .bashrc file or close your console window and reopen it.




回答2:


Can't tell without seeing your build.xml file. However, the message looks very detailed. It says you need to generate a "local.properties" file, probably to set where sdk.dir is located.

In Ant, you can have a properties file that sets properties your Ant build.xml file uses. It says you can use android update project to create this file. Again, it's hard to say without knowing what your build.xml looks like, what project you're trying to build, etc.

A quick Google pointed me to this page.



来源:https://stackoverflow.com/questions/13837930/ant-failed-to-build-on-ubuntu

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!