管理code /构建Android应用程序商店(谷歌/亚马逊/等)? [英] Manage code/build for Android app stores (Google/Amazon/etc)?

查看:333
本文介绍了管理code /构建Android应用程序商店(谷歌/亚马逊/等)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个真实,主要从Android Market(现在,谷歌播放)下载的Andr​​oid应用程序。我们做了一些调整,以源,并提交到亚马逊的应用程序商店,看看什么样的牵引它得到。我现在正在寻找一个可持续的方式,从一个共同的code基地,大力发展,但建立这样我可以提交到/两者。

I have an Android app that's downloaded primarily from Android Market (now, Google Play). We made a few tweaks to the source and also submitted to the Amazon App Store to see what sort of traction it gets. I'm now looking for a sustainable way to develop from a common code base and yet build so that I can submit to either/both.

亚马逊的商店大约有可用的API一些限制,所以我想有条件地从该版本中删除/修改功能。由于Java不支持传统的条件编译,并有条件地包括文件在Eclipse中似乎不平凡的(是它甚至可能吗?),我想问问别人在做什么来解决这个问题。

Amazon's store has some restrictions about available APIs, and hence I'd like to conditionally remove/modify features from that version. Since Java doesn't support traditional conditional compilation, and conditionally including files in Eclipse doesn't seem trivial (is it even possible?), I wanted to ask what others are doing to solve this.

当然,我不是的Eclipse / Java专家可以随意学校我。

Admittedly, I'm no Eclipse/Java expert so feel free to school me.

我在寻找什么在一个解决方案:

What I'm looking for in a solution:

  • 在使用Eclipse建筑/调试。
  • 在静态code文件,环境/设置切换控制建设什么。
  • 在code无重复code或条件逻辑来接在运行时code流量

这是不是你已经解决了对Android应用程序专,或其他Java /基于Eclipse的项目?建议从哪里开始?

Is this something you've solved for Android apps specifically, or for other Java/Eclipse based projects? Suggestions for where to begin?

推荐答案

这是很容易做到的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:

  1. 创建一个新的Andr​​oid项目( PROJ-A 的)
  2. 转到项目 - >属性,选择Android和检查是图书馆
  3. 将所有常用的code到的 PROJ-A 的,导入所有必要的库
  4. 创建一个新的Andr​​oid项目,谷歌播放(凸出-B 的)
  5. 转到项目 - >属性,选择Android和添加的 PROJ-A 的到库
  6. 在重复#4和5亚马逊版本
  1. Create a new Android project (proj-A)
  2. Go to Project->Properties, select Android, and check "Is Library"
  3. Move all your common code to proj-A, import all the necessary libraries
  4. Create a new Android project for Google Play (proj-B)
  5. Go to Project->Properties, select Android, and add Proj-A to the Library
  6. Repeat #4&5 for the Amazon version

如果你有一些变量,应设置不同的每个分项目(即布尔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:

  1. 所有的分项工程的具体变量拉成只是充当容器(S)的一个或多个类别为这些变量
  2. 创建一个虚拟的Java项目(的)
  3. 配置的 PROJ-A 的添加新的源链接的bin目录中的虚拟
  4. 添加在每个子项目的配置类与特定项目的修改
  5. 利润!
  1. Pull all of your sub-project specific variables into one or more Classes that just serves as container(s) for these variables
  2. Create a "dummy" Java project (dummy)
  3. Config proj-A to add a new Source link to the bin directory of dummy
  4. Add the config Classes in each sub-project with project-specific changes
  5. Profits!

请注意,在变量的虚拟的应该的不可以设置为决赛,否则会覆盖分项目的设置。

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.

这篇关于管理code /构建Android应用程序商店(谷歌/亚马逊/等)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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