2

I am releasing two versions of an app--free and paid. The differences between the two are few, and I would like to release both using the same codebase (maybe a different constant defined for the other build?). Has anyone done this? Can someone point me in the right direction? Thanks!

Will
  • 24,082
  • 14
  • 97
  • 108
  • possible duplicate of [Release several android applications with same code base](http://stackoverflow.com/questions/3541125/release-several-android-applications-with-same-code-base) – Paŭlo Ebermann Jul 03 '11 at 19:35

1 Answers1

4

Use an Android library project, which was specifically designed for your free/paid scenario.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • So the libraries can contain activities, etc? And I just include the lib in both projects? Is there an example of this anywhere? – Will Nov 03 '10 at 13:58
  • @Will: "So the libraries can contain activities, etc?" -- yes. "And I just include the lib in both projects?" -- yes. "Is there an example of this anywhere?" -- I have a few, but none contain activities, since I use them for reusable components (e.g., custom Views). – CommonsWare Nov 03 '10 at 16:08
  • 1
    Note that if you try to share a ContentProvider you'll run into some problems - ContentProviders typically hardcode an AUTHORITY and/or CONTENT_URI, which is find for one app, but won't work because multiple apps can't have the same content provider authority. While is is possible to get the authority that's been specified in the application manifest at runtime, it still throws a kink in things. Just something to keep in mind if you think about wandering down the shared library path. – thom_nic Jun 24 '11 at 14:05