How to automate android builds for lite and premiu

2020-05-27 14:39发布

I'm looking for a solutions which will allow me to build lite and premium versions of my android app without manual manipulations. The functionality I'm looking for is:

  • Automatically renaming package
  • Changing home package name in AndroidManifest.xml file.
  • Changing constant values in java or/and resource files or substituting appropriate files for current application version.

Thanks.

3条回答
啃猪蹄的小仙女
2楼-- · 2020-05-27 15:06

I strongly suggest you the use of an ant build for this. I have described in one article step by step the Once Click Build technique. The article covers also the creation of Java files based on parameters, copy files etc.

http://www.androider.ro/cum-fac-un-build-automat-cu-ant-in-android-ocb-one-click-build-1501

查看更多
贪生不怕死
3楼-- · 2020-05-27 15:10

I would suggest looking into Android Library Projects to help with this.

I use this approach for a Lite vs. Free edtions of one of my apps. I have a Library project that contains all of the source and most of the resources for the apps and then 2 projects that use the 1st as a library project, one for Lite and one for Full edition.

The two dependent projects each have their own resources and manifest, allowing the namespace to be different and for me to swap in different strings, drawables, etc. depending on the edition.

I tried the Ant approach but it seemed to be much more of a hassle than the Library project approach. Hope that helps.

Note that Ant is still used to build each of the projects, but not part of the solution for separating editions.

查看更多
SAY GOODBYE
4楼-- · 2020-05-27 15:32

I use Ant for this.

I have three directories containing source and resources:

/common
/lite
/full

Before building I merge the appropriate two trees together in a temporary directory and build that.

查看更多
登录 后发表回答