我正在寻求优化同一 Android 应用生成略有不同的 APK,唯一的区别是它使用的 http API 服务器 (dev/staging/prod)。
理想情况下,我只希望我的 Eclipse 构建 2 个 APK,一个用于生产服务器,一个用于开发服务器。
我什至可以有 2 个运行配置,但我无法弄清楚如何将参数传递给应用程序并从代码中读取它们。
我想以 1.5 为目标,顺便说一句,我想使用 Eclipse 自动构建工具,所以我正在寻找最通用的解决方案。
谢谢。
最佳答案
我认为使用 ant 构建脚本将是最简单的解决方案。 Eclipse 支持 ant 构建,所以你可以在 eclipse 中运行 ant 命令。
你可以像这样用 Ant 解决你的问题。
xml 会是这样的:
资源 #1:
<resources>
<string name="target">dev</string>
</resources>
资源 #2:
<resources>
<string name="target">staging</string>
</resources>
ant 脚本会是这样的:
<project>
<target name="build_all">
<copy file="res1.xml" to="res/values/target.xml"/>
<ant antfile="build.xml" target="debug"/>
<copy file="res2.xml" to="res/values/target.xml"/>
<ant antfile="build.xml" target="debug"/>
</target>
</project>
https://stackoverflow.com/questions/3983492/
相关文章:
visual-studio-2010 - 错误 MSB6006 : "cmd.exe" exited
plugins - 如何将作业放入 Jenkins 的 Throttle Concurrent Bu
java - Eclipse ADT appcompat... 它是什么?
xcode - "Run Script"在构建阶段需要什么权限?
c++ - 如何使用语言支持等进行 "light"构建的 GCC 修剪?
build - Jenkins/Hudson 中有哪些属性可用于构建配置?
visual-studio-2010 - Visual Studio 未知生成错误。完全限定名称必须