What is the recommended way to create Android libraries for use in applications?

I have an application, say MyApp Free. I want to create MyApp Pro, which I can charge for it, has some additional features. The obvious way is to have a library containing almost all of the application code, and then two Android application projects for the Free and Pro versions that link to this library.

Suggestions?

+4
source share
3 answers

Check out my github page for the CWAC project series - they all create JAR files for reuse in other projects.

In short, there is not much magic for simple JARs, except that you add the Android JAR to your build path to compile your code that references the Android API.

However:

  • It is difficult to share resources. I am currently working on a solution for this.
  • There may be components in the JAR (actions, services, etc.), but the applications themselves must still list these components in the manifest of these applications.
+3
source

In your specific situation, you can simply write one project, and then add a little static Boolean to it, which determines whether it is a free version of the paid version. I think it doesn’t matter if the added functionality does not include a much larger load.

0
source

Another option is to keep a separate branch in your code repository for the free version, this is what I do. You need to change AndroidManifest.xml for the free version on a free branch.

See software version 2: the best VCS approach?

0
source

Source: https://habr.com/ru/post/1303854/


All Articles