3

I used the product flavors to build the different apps. If I select free flavor in the build variant before running the app the free flavor will be run if I select paid flavor the paid will be run.

I want to change in the run time means after running the app if we click on button it has to change paid app. Is there any chance to change the build variant selection run time through programming.

class productFlavors {
    free{

    }

    paid{

    }
}

I used these as flavors.

If anyone knows the solution please help me to solve my problem.

Thanks in advance.

Dinesh Shingadiya
  • 988
  • 1
  • 8
  • 23
v teja
  • 613
  • 2
  • 7
  • 17

1 Answers1

5

I want to change in the run time means after running the app if we click on button it has to change paid app

That is not possible. Product flavors are something applied at compile time. Your free app does not have the resources, Java code, manifest entries, dependencies, etc. that are solely in your paid product flavor.

You will need to get rid of your product flavors and have a single build, where you have runtime logic to decide whether to offer the free or the paid set of features.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • hi is there any other way to run the second app into that app when click on button – v teja May 06 '19 at 11:47
  • @gowthami: If the user has both apps installed, you could have the button click start an activity in the other app. However, the user would need to have both apps installed. – CommonsWare May 06 '19 at 11:48
  • no only one app in play store another small app extension of the first app has to install in place of the first app. – v teja May 06 '19 at 12:02
  • @gowthami: There may be ways that you can use feature modules with app bundles for that scenario -- I do not use those, and AFAIK they are only available for the Play Store. – CommonsWare May 06 '19 at 12:06