1

I have an existing gradle-based Android application, and I would like to use it as a library module in another app while still being able to build it a standalone app (and keep the same package name).

I've tried to convert it into a library module and create a new app that wraps it, but the app cannot have the same package name as one of its lib modules.

Changing the package name of the standalone app is not an option because it's alreayd published on the Play Store. And changing the package name of the library module would have huge impacts (e.g in the java code).

How could I achieve that?

Is there any other altenative, such as having two build.gradle files in the project (one for app module definition, and one for the library module)?

sdabet
  • 18,360
  • 11
  • 89
  • 158
  • 2
    "And changing the package name of the library module would have huge impacts (e.g in the java code)" -- why? At most, this changes the `R` class package, requiring at most one added/changed `import` per file. What other impacts are you perceiving? – CommonsWare Feb 17 '16 at 13:00
  • @CommonsWare Well, modifying each java file sounded like a big deal, but it might be the best option in the end... – sdabet Feb 17 '16 at 13:07
  • @CommonsWare Feel free to post it as an answer – sdabet Feb 19 '16 at 14:03
  • Well, it doesn't really answer your question as stated. My comment perhaps addresses your underlying problem. I am not aware that there *is* an answer to your question, though I can't rule it out. – CommonsWare Feb 19 '16 at 14:08

0 Answers0