我也有类似的问题,并在构建我custon Ant脚本来构建应用程序结束了。您可以运行宏或正则表达式来分配一个资源或另一个资源。
编辑:
首先,添加的build.xml到项目:
打开一个命令提示符并导航到你的项目的目录:
android update project --path
然后,可以覆盖现有的build.xml,如下所示。
注:此Ant脚本只是一个例子,我没有测试它:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Example" default="help">
<property file="local.properties" />
<property file="ant.properties" />
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
unless="sdk.dir"/>
<!-- IMPORT ANT?S BUILD.XML -->
<import file="${sdk.dir}/tools/ant/build.xml" />
<property name="app.icon" value="${icon}" />
<property name="icon.file" location="res/drawable/icon.png" />
<target name="test-release">
<antcall target="test-pre-release" />
<antcall target="release" />
</target>
<target name="test-pre-release">
<copy file="${app.icon}" tofile="${icon.file}" overwrite="true"/>
</target>
</project>
然后,构建该项目使用自定义图标,打开命令提示符,然后转到项目目录:
CALL ant -f build.xml test-release -Dicon=path/to/your/icon.png
如上所述,这是一个非常基本的例子。要建立一个良好的脚本,你必须了解一点的Ant语法,但它并不难。
我以前从未使用过蚂蚁;可以把它集成到Eclipse的工作流程,或者我需要用我想要重新构建和分发每次命令行? – 2012-07-21 14:43:10
蚂蚁来构建应用程序。您可以检查SDK位置内的现有Ant脚本(例如... \ android-sdk \ tools \ ant \ build.xml)。而且,为了建立你自己的...有很多教程可以解释这个过程。例如。 http://www.enterra-inc.com/techzone/using_ant_android_applications_building/ – 2012-07-21 14:47:39
您能否在您的答案中添加一个Ant脚本示例以说明您是如何实现这一目标的? – 2012-07-21 14:59:01