如何为 Android 项目创建 build.xml? [英] How to create build.xml for an Android project?

查看:28
本文介绍了如何为 Android 项目创建 build.xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试运行直接从Beginning Android 4"一书的源代码下载中获得的简单程序.但是,我对 build.xml 文件有很多问题(请参阅以前的问题,这些问题没有得到解答).我最新的是,它来自一个简单的 Label 演示程序:

I've been trying to run simple programs that I obtained directly from the Source Code download for the book 'Beginning Android 4'. However, I have lots of problems with the build.xml files (see previous questions, which are unanswered). My latest is, which comes from the a simple Label demo program:

# ant debug
Buildfile: /home/me/src/ANDROID/MyProjects/Label/build.xml

BUILD FAILED
Target "debug" does not exist in the project "LabelDemo". 

然后我检查了其他工作的 build.xml 文件,并且尽我所知,通过文件的文本 grepping,那里也不存在调试".但它们有效.

I then checked with other working build.xml files and as fasr as I can tell, grepping thru the text of the file, 'debug' doesn't exist there either. But they work.

所以,我显然一定是错误地创建了 build.xml 文件.为 Android 项目创建构建文件的正确方法是什么(从命令行).

So, I obviously must be creating build.xml files incorrectly. What is the correct way to create the build file for an Android project (from the command-line).

推荐答案

运行android update project -p ...,其中... 是项目的路径.这将创建或更新 build.xml 和相关的命令行构建文件.这假设您的 SDK 的 tools/ 目录在您的 PATH 中;否则,您需要完全限定 android 命令的路径.

Run android update project -p ..., where the ... is the path to the project. This will create or update the build.xml and related command-line build files. This assumes that your SDK's tools/ directory in your PATH; otherwise, you will need to fully-qualify the path to the android command.

这篇关于如何为 Android 项目创建 build.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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