0

I have two custom flavors - free and paid. Free flavour comes with basic features whereas the paid one comes with advanced features.

I invoke paid version files from free. This works fine in paid build variant since this will include both(free and paid) src folders. If I change to the free variant, the call to paid variant files is not recognized. What is the right way to do this?

Sureka
  • 1
  • 1
  • Usually when using flavors, always make seperate logic for different product flavors in it's seperate folder. If that's not possible, use `Classloader` API to load your desired class. – Jeel Vankhede Sep 13 '19 at 06:36
  • My case is - I have an activity that does some functionality in both free and paid versions. In the paid version, I want to add another feature in the same activity. Even if I move the feature-specific code to the paid flavor folder, how do I call this? – Sureka Sep 13 '19 at 07:23
  • I would suggest to make a class that exists in both flavor specific folder (Not activity itself) then from your activity in main folder, access that functionality from that. It won't be problem because now both flavor contains that class. Then just use some interfacing logic to finalize your business logic. – Jeel Vankhede Sep 13 '19 at 07:26

0 Answers0