针对不同的市场使用蚂蚁导出多个APK [英] Export multiple apk for different market using ant
问题描述
我的Android应用程序针对的是20+的市场,每一个在manifest.xml几个不同的属性。结果
要释放20+陆续APK一个是真的费时,我试图使用Windows批处理文件来完成发行工作在一个单一的点击。结果
现在,我用本教程提供的解决方案这里变化在manifest.xml外地,但我不知道的蚂蚁很好,所以我用一个非常破解的方法来完成这项工作在批处理文件象下面这样:
My Android app is targeted to 20+ market, each with several different properties in the Manifest.xml.
To release 20+ apk one after another is really time-consuming, and I tried to use the windows batch file to do the release job in a single click.
For now, I use the solution provided by the tutorial here to change the field in the Manifest.xml, but I don't know ant well, so I use a very hack method to do the job in batch file like below:
start cmd.exe /c "ant config-google-play release_mine"
REM the line below is for waiting for the former task to finish
ping 1.1.1.1 -n 1 -w 90000 > nul
start cmd.exe /c "ant config-eoemarket release_mine"
ping 1.1.1.1 -n 1 -w 90000 > nul
....
有没有做到这一点了一些优雅的方式?像刚刚在build.xml文件编辑目标做蚂蚁等。
Is there some elegant way to accomplish this? like just editing targets in build.xml to do it in ant, etc.
推荐答案
我的最终解决方案:结果
定义任务:
My final solution:
Define task:
<target name="modify_manifest">
<property
name="version.market"
value="${channel}"/>
<property
name="out.final.file"
location="${out.absolute.dir}/${ant.project.name}_${channel}_${project.version.name}.apk"/>
<antcalltarget="release"/>
</target>
然后包括蚂蚁的contrib的* .jar作为回答这里,所以我可以使用环路蚂蚁。然后定义以下
Then include ant-contrib*.jar as the answer here so that I can use loop in ant. Then define a new task below
<target name="deploy" >
<foreach
delimiter=","
list="${market_channels}"
param="channel"
target="modify_manifest" >
</foreach>
</target>
使用蚂蚁部署做任务。结果
market_channels应ant.property被定义为如下:
Use "ant deploy" to do the task.
market_channels should be defined in ant.property as follow:
market_channels=google-play,other,...
这篇关于针对不同的市场使用蚂蚁导出多个APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!