Android Studio Tutorials - Gradle Flavours
Why Stack Overflow recommends it
Stack Overflow users link it when answering how to build free and paid, demo and full, or staging and production versions of an Android app from one codebase.
Recommended by 7 people across 5 different months, 2014 to 2017.
What it is
A 2014 screencast tutorial from TwistedEquations showing how to use Gradle product flavours in Android Studio to build several variants of an app from one shared code base. It walks through build types and flavours with a companion GitHub project.
What people said
Recommends wissem46 · 2014-03 · Stack Overflow · on “Generating more than one apk , with same resources , with different app names , using Gradle”
well ,that resolved my problems ,the documentation was so helpful,i created two different small apps : free and paid version, i used also this tutorial , and that helped me alot [this video]
Recommends Distwo · 2014-04 · Stack Overflow · on “How do you manage multiple environments while developing Android apps?”
This I think is considered as the bast practice in case you use android studio with gradle. You may want to look at this article: [LINK] Also available in youtube video: [this video] This also allows you to have two different package name for the same app. It uses gradle flavors to achieve exactly what you are looking for and is very easy to implement.
Recommends electronix384128 · 2014-04 · Stack Overflow · on “Creating demo and full version app based on one code base/project”
I tried this approach. The main problem here is that you have to copy code and you end up having three projects! The better way is actually using flavors. This is a great tutorial which helped me: [this video]
Recommends Ivan Stoiev · 2014-07 · Stack Overflow · on “Android: Organize for different build targets / read resource files runtime”
Like ChrLipp [LINK] said, on bleeding edge Android Studio, there is a convenient solution called " flavours [this video] ". It's based on mirrored directories hierarchy. A "main" directory hierarchy that contains all files of a "main" build, and "flavours" directories hierarchies, each flavor directory contains files that will overwrite or complement those "main" ones at build time. For my use (I can't migrate to Android Studio), I wrote a simple ant script to imitate " flavours [this video] " feature. It works on Netbeans and Eclipse, and I think it's some sort of project-independent. To use it, the full project folder have to step back one level of hierarchy, and the original one needs to be placed
Recommends Tofasio · 2015-04 · Stack Overflow · on “The best way to make premium version of application?”
Try Gradle Flavours, they let you create different apk's with different package names. This video help me a lot: [this video]
Recommends murielK · 2015-04 · Stack Overflow · on “Android API webservice for drop down and multilanguage support”
What you did is fine so far but instead of creating 2 different file "staging" and "production", i will recommend you to create instead two flavor in your project gradle, staging and production. And place both file int he appropriate folder and i can guarantee you that the both ID will be the same. PS : note that you will have to build different apks base on the buildVariant (flavor + builtype) Example if you want to have access to your staging file you will have to build a separate apk, that is how flavor work and i hope that it is what you are looking for. Have a look a this links about flaovrs LINK1 [LINK] LINK2 [LINK] (scroll down a bit for flavor) Last but not least take a look at this
Recommends user6380431 · 2017-01 · Stack Overflow · on “Android making multiple flavors due to layout changes.”
Using flavours you can do it, flavours are not used only for text or color changes, you can even specify your buissnes logic as well. watch this video [this video]
Cites Ivan Stoiev · 2014-07 · Stack Overflow · on “Building many similar Android .apk files at the same time?”
2011 is a long time ago.. but it seems that there is no Eclipse/Netbeans solution on this. I faced the same problem recently on a cordova project on Netbeans. On bleeding edge Android Studio, there is a convenient solution called " flavours [this video] ". It's based on mirrored directories hierarchy. A "main" directory hierarchy that contains all files of a "main" build, and "flavours" directories hierarchies, each flavour directory contains files that will overwrite or complement those "main" ones at build time. For my use (I can't migrate to Android Studio), I wrote a simple ant script to imitate that feature. It works on Netbeans and Eclipse, and I think it's some sort of project-independent.