[英]How can I build multiple Android app builds for beta testers and for the Market?
I would like to produce 2 builds of my Android app: 我想生成2个Android应用程序的构建版本:
Is there an easy way to modify my build to build both these artifacts? 有没有一种简单的方法可以修改我的构建以构建这两个工件? If I could just set a single variable's value to something passed in on the command line during the build, I could dispatch on that value in different parts of the app for different behavior.
如果我可以将单个变量的值设置为在构建过程中在命令行中传递的内容,则可以针对不同的行为在应用程序的不同部分中分派该值。 However, I'm not sure that's the best way to do this, nor do I know a good way of getting that into my code.
但是,我不确定这是最好的方法,也不知道将其纳入代码的好方法。
I'm using the off the shelf build.xml file that Android produced for me right now. 我正在使用Android现在为我生成的现成的build.xml文件。
Thanks! 谢谢!
When you have an automatic build chain (ie running everything through ant), you can create one java file that contains that variable from the ant run. 当您具有自动构建链(即,通过ant运行所有内容)时,您可以创建一个java文件,其中包含来自ant运行的变量。 And here you can set the variable depending on the target environment.
在这里,您可以根据目标环境设置变量。 The build will then compile that file with all others and package it up.
然后,该版本将与所有其他文件一起编译该文件并将其打包。
It may be possible to also have a replace task in ant, that takes an existing file and just replaces a token ##var##
with the variable content. 也可能在ant中有一个替换任务,该任务需要一个现有文件,而只是用可变内容替换标记
##var##
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.