Ant 无法在 Ubuntu 上构建 [英] Ant failed to build on Ubuntu

查看:30
本文介绍了Ant 无法在 Ubuntu 上构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人能帮我解决这个问题.我正在使用 Ant Build 来编译我的 java 代码,但出现以下错误:

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

我正在使用日食.

推荐答案

这个问题有两种解决方案,如错误信息中所述:

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

  1. 在 Android 项目根目录的 local.properties 文件中设置 sdk.dir 变量的值.这需要指向您的 Android SDK 安装位置.例如,我有以下行:

  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

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

您可以手动执行此操作或使用 android update project 命令为您生成它.

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

或者,您可以在主目录的 .bashrc 文件中设置 ANDROID_HOME 环境变量.您可以通过添加类似以下行的内容来执行此操作:

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:

导出 ANDROID_HOME=/usr/local/bin/android-sdk-linux

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

请注意,您需要找到 .bashrc 文件或关闭控制台窗口并重新打开它.

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

这篇关于Ant 无法在 Ubuntu 上构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆