简体   繁体   中英

Is there a chance to change the build variants run time in android

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM