更新时间:2022-12-21 15:08:07
这是很容易做到的ADT(17版)的最新版本,虽然我觉得它使编译的时间长一点:
It's quite easy to do in the newest versions of ADT (version 17), though I do find it makes compilation a bit longer:
如果你有一些变量,应设置不同的每个分项目(即布尔GOOGLE_PLAY_VERSION,使谷歌播放特定功能),你必须创建另一个项目为包含这些值,因为你不能有引用单项目另一个以循环方式。您可以通过添加以下步骤解决这个问题:
If you have some variables that should be set differently for each sub project (i.e. boolean GOOGLE_PLAY_VERSION to enable Google Play specific functions), you have to create another project to contain these values since you can't have projects that reference one-another in a circular fashion. You can solve this by adding the following steps:
请注意,在变量的虚拟的应该的不可以设置为决赛,否则会覆盖分项目的设置。
Note that the variables in dummy should not be set as final, otherwise it will override sub-project's setting.
这似乎是相当多的前期工作,但一直做得很不错,我尽可能的版本控制去。
This may seem like quite a bit of up-front work, but has worked quite well for me as far as version control goes.
编辑: 现在,与谷歌的举动,Android的工作室和放大器;摇篮,它可能是更好的移动到,如果你正在开始一个新的项目,如果要支持多个APK,看到Android开发网站的与摇篮#工作与构建生成项目变种。它绝对不伤害,才决定以评估该选项。
Now with Google's move to Android Studio & Gradle, it may be better to move to that if you are starting a new project if you want to support multiple APKs, see Android dev site's Building Your Project with Gradle#Work with build variants. It definitely doesn't hurt to evaluate that option before deciding.