Android的Ant项目参考 [英] Android Ant project reference

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

问题描述

我有一个Android项目,它有一个(Java)的项目文件夹的参考。我开发了日食。现在我想编译使用Ant。我想在build.xml中加入包含参考什么。

I have an Android project and it has a (Java) project folder reference . I developed with eclipse. Now I want to compile with Ant. What I want to add in build.xml to include the reference.

推荐答案

假设你的项目被称为HelloListview(说),你希望你的所有的Ant生成的二进制文件,结束了Eclipse工作区外,则:

Assuming your project was called 'HelloListview' (say) and you want all your Ant produced binaries to end up outside the Eclipse workspace, then:

Firtsly,如果你在这里遵循的步骤: <一href="http://developer.android.com/guide/developing/other-ide.html">http://developer.android.com/guide/developing/other-ide.html

Firtsly if you follow the steps here: http://developer.android.com/guide/developing/other-ide.html

下创建一个新的项目

然后:

1)在示例项目产生的build.xml和build.properties和local.properties复制到Eclipse项目中。

1) copy the build.xml and the build.properties and the local.properties produced in the sample project to your Eclipse project.

2)编辑build.xml文件的项目标记的第一线,说是这样的:

2) Edit the first line of the build.xml's project tag which says something like :

<project name="TestProject" default="help">

将其更改为只

Change it to just

<project>

3)现在编辑build.properties定义一些的自定义属性的定义输出位置,并设置蚂蚁main_rules.xml需要引用它们,就像属性:

3) Now edit the build.properties to define some custom properties that define output locations and set the properties that the Ant main_rules.xml requires to refer to them, like:

#Start of custom properties defined by you
projectname=HelloListView

# The parent of where you want ALL your ant builds to go
outbasebase.dir=/junk/MyAntBuilds

# The binaries for this project
outbase.dir=${outbasebase.dir}/${projectname}

#End of custom properties defined by you

#Ant main_rules.xml refers to these properties
ant.project.name=${projectname}
out.dir=${outbase.dir}/bin
# end of Ant required properties

4)现在,在命令行只需键入蚂蚁调试和二进制文件最终会在\垃圾\ MyAntBuilds \ HelloListView \ BIN(或任何你决定把它在构建。性能)

4) Now at the command line just type 'Ant debug' and your binaries will end up in \junk\MyAntBuilds\HelloListView\bin (or whatever you decide to call it in the build.properties)

您可以使用相同的build.xml为所有的项目,因为没有参考的build.xml文件本身的项目,你只需要改变在build.properties的项目名称为新的项目。

You can use the same build.xml for all your projects, as there is no reference to the project in the build.xml itself, you merely have to change the projectname in the build.properties for the new project.

当你获得更多的自信,你可以调整build.properties包括密钥库名和密码,以产生释放签署建立自动,加入像行:

When you get more confident, you can adapt the build.properties to include your keystore name and password to produce release signed builds automatically, by adding lines like:

key.store=c:/users/you/my-release-key.keystore
key.alias=release_alias
key.store.password=YourPwd
key.alias.password=YourPwd

如果要包括外部Java源那么最好以自定义整个build.xml文件。 按照生成的构建列出的说明。 XML:

If you want to include external java source then it's best to customise the whole build.xml. Follow the instructions listed in the generated build. xml :

- Customize the whole script.
- copy/paste the content of the rules files (minus the top node)
into this file, *after* the <setup> task
- disable the import of the rules by changing the setup task
below to <setup import="false" />. 
- customize to your needs.

即复制main_rules.xml到您的构建文件,并禁止进口的描述。

i.e copy the main_rules.xml into your build file and disable the import as described.

然后在编译的目标

.....       
.....
<src path="${source.absolute.dir}" />
<src path="${gen.absolute.dir}" />
<src path="${common_src}" />     <<<<<<< ADD THIS LINE (OR WHATEVER PROPERTY NAME YOU LIKE TO GIVE IT)
.....
.....

和添加引用common_src在你的build.properties

and add a reference to the common_src in your build.properties

common_src=/otherfiles/sourcefolder

这篇关于Android的Ant项目参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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