你如何发布两个版本在市场的应用程序吗?应用程序、两个、版本、市场

2023-09-05 03:12:11 作者:取苍穹一隅

我想补充两个版本我的应用程序到Android市场,一个是几毛钱,还有一个免费版本,有广告。这是一个非常普遍的做法。

I would like to add two versions of my app to the Android Market, one for a few cents, and one free version, with ads. That's a very common practice.

我目前正在建设AdMod到我的应用程序,它似乎我不得不改变相当多的文件,因此它似乎最好让我的应用程序的独立版本这一点。

I'm currently building AdMod into my app, and it seems I'll have to change quite a few files, so it seems best to make a separate version of my app for this.

你怎么做到这一点?一个分支?不同的存储库?有没有人找到了一种方法来保持在一个合理的方式在同一个存储库这两个应用程序?

How do you achieve that? A branch? A different repository? Has anyone found a way to keep both apps in the same repository in a reasonable manner?

标题没有拼写错误,我的意思是实现,即人们如何管理这两个版本,而不是如何将它们添加到市场。的

推荐答案

这种事情是一个完整的噩梦 - 不幸的是,Android的编译系统并不真正支持它在任何好的办法

This kind of thing is a complete nightmare - unfortunately the Android build system doesn't really support it in any good way.

我们通过在库项目有99%的我们的应用程序的code做到这一点。然后,我们创建一个应用项目的每个不同版本的应用程序的,其中每一个使用该库

We do it by having 99% of the code of our application in a library project. We then create one application project for each different version of the app, each of which use that library.

我们需要不同版本的应用程序的表现不同,我们目前做到这一点通过让那些质疑在运行时不同的资源。我们正在转向使用但通过RoboGuice依赖注入的过程。

Where we need different versions of the app to behave differently, we currently achieve that by having different resources that are queried at runtime. We are in the process of moving to using Dependency Injection via RoboGuice, however.

有指合理工作良好不这样做的这种元素,和其他。这是必要的,例如,复制的Andr​​oidManifest.xml文件,它可以是易出错(它很容易,例如,一个新的活动添加到一个清单和忘记这样做,在其它)。这是一个烂摊子,遗憾的是,却是最不坏的解决方案,我们已经找到了。

There are elements of this that work reasonably well, and others that don't. It's necessary, for example, to duplicate the AndroidManifest.xml file, which can be error-prone (it's easy, for example, to add a new activity to one manifest and forget to do so in the others). It's a mess, unfortunately, but the least-bad solution we've found.

就个人而言,我会强烈建议不要使用分支来达到这种效果。他们可以很好地工作初期,但会迅速成为一个维护的噩梦。

Personally speaking, I would strongly advise against using branches to achieve this effect. They can work well initially, but will rapidly become a maintenance nightmare.

使用图书馆的一个附带的好处是,我们发现,它使测试变得相当容易。有关如何设置此示例,请参见:

One side benefit of using a library is that we've found that it makes testing considerably easier. For an example of how to set this up, see:

的http://www.paulbutcher.com/2010/09/android-library-project-with-tests-step-by-step/