定制Ant任务自动化的Andr​​oid APK代 [英] Custom ant task to automate android apk generation

查看:140
本文介绍了定制Ant任务自动化的Andr​​oid APK代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的自动化的Andr​​oid APK生成过程。该应用程序从服务器获取数据,我有两个服务器,一个是用于测试,其中包含虚拟数据,和另一个用于实际发布,其中包含真实的数据。这些服务器的URL的的strings.xml 文件中提到的。

I want to automate my android apk generation process. The app fetches data from server, I have two servers, one is for testing which contains dummy data, and the other one for actual release which contains real data. URL of those servers are mentioned within strings.xml file.

现在我需要产生两个不同的APK,一个指向测试服务器,另一个指向真实服务器的自定义Ant任务。

Now I need a custom ant task for generating two different apks, one pointing to the test server and the other one pointing to the real server.

我的问题是,我不知道该怎么写从Ant脚本的strings.xml 文件,以便它可以更改相应的网址。

My problem is, I don't know how to write strings.xml file from ant script so that it can change the URLs accordingly.

推荐答案

您可以在蚂蚁使用替换任务。事情是这样的:

You could use the replace task in ant. Something like this:

<replace file="res/values/strings.xml" token="@@@" value="http://myUrl"/>

这篇关于定制Ant任务自动化的Andr​​oid APK代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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