维护多个市场的 Android 应用程序(在 Git 上)
我已将我的应用程序作为免费版和专业版发布到 Android 市场。所有源代码都存储在一个 git 存储库中。
我现在想将应用程序发布到另一个应用程序市场。由于只有少数文件会发生变化(Android 许可),我正在考虑归档此文件的最佳方法是什么。
我认为,一种方法是 Android 库项目。 但是我可以使用 git 归档类似的效果,这样我就可以拥有两个共享一个代码库并且仅存在几个文件不同的存储库吗? 由于我目前对git不太熟悉,请准确解释一下我需要做什么或需要注意的地方。
谢谢。
I have my App published as a free and pro version to the android market. All sourcecode is stored in one git repository.
I now want to publish the app to another app market. Since only a few files will change (Android Licensing) I'm thinking about what would be the best way to archive this.
One way would be Android Library Projects, I think.
But can I archive a similar effect by using git, so that I habe two repositories which share one codebase and do only differ by a few files?
Since I'm currently not that familiar with git, please explain precisely what I need to do or where I need to pay attention to.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我存储应用程序的所有变体都使用一个 git 存储库。例如,我的一个应用程序有免费版和专业版,并且在 Android 市场和亚马逊应用程序商店上都有提供。在git中,我有3个分支:
Master是免费版本,pro是Android市场上的付费版本,amzn是亚马逊应用商店上的免费版本。
我在 master 中进行了所有功能更改。一旦我准备好发布,我就会构建并测试免费版本,然后用发布号标记 master。然后我切换到专业版,并运行 git merge master 来引入所有新的更改。
由于pro是付费版本,当我第一次从master分支时,我注释掉了广告相关的代码(因为只有几行,我认为没有必要进行任何重构),
并将所有字符串更改为引用“Some App Pro”,而不仅仅是“Some App”。
在合并过程中,我通常不会发生任何冲突,并且会保留原始修改。但如果没有,很容易解决冲突并使专业分支恢复无广告状态。
同样,对于 amzn 分支,我最初删除了对 Google 市场的任何引用,并在准备发布时从 master 进行合并。
然后对于 pro 和 amzn,我可以构建测试和标签。
为了保持包名称的唯一性(我实际上不确定是否是必需的),我首先将我的 Activity 移至新包,即 com.whatever.free.appname、com.whatever.pro.appname.. 。
Using one git repo for all variations of an app is how I store mine. For example, one of my apps has a free and a pro version, and is available on both the Android market and the Amazon app store. In git, I have 3 branches:
Master is the free version, pro is the paid version on the Android market, and amzn is the free version on the Amazon app store.
I do all my feature changes in master. Once I'm ready to do a release, I build and test the free version, then tag master with the release number. I then switch over to pro, and run a git merge master to bring in all the new changes.
Since pro is a paid version, When I first branched from master, I commented out the ad related code (since it was only a few lines, I didn't think any refactoring was necessary),
and changed any strings to refer to "Some App Pro" instead of just "Some App".
During the merge, I typically don't have any conflicts, and that original modification is maintained. but if not, it's pretty easy to resolve the conflicts and get the pro branch back to being ad free.
Likewise for the amzn branch, I originally removed any references to Google's market, and do a merge from master whenever I'm ready to release.
Then for both pro and amzn, I can build test and tag.
To keep package names unique (which I'm not actually sure is a requirement or not), I first took my Activities and moved them to new packages, ie com.whatever.free.appname, com.whatever.pro.appname...
为您的应用程序的新版本设置一个新分支,进行不同的更改。然后继续在 master 分支上工作并在发布这两个分支之前重新设置新分支的基础。
Setup a new branch for the new version of your App, do the changes which differ. Then continue to work on the master branch and rebase your new branch before you release both.