Previous proposalKeep Calm and Secure your App
Flavors & Variants: Utilise Gradle to maximise code reusability
Gradle throws the doors open for build variants and flavours. As the name suggests both allow you to build slightly different editions of your app, while reusing the core code that is common.
We will be exploring what all can be common-ified, and how best can flavours and variants be used. Also we will look at how dependencies and libraries can also be managed per-flavour or per-variant.
Flavours and Variants can be used to build a lot of different editions. For example paid version vs free version. Or, for example, on a recent FOSSASIA project I was working on, we created two flavours - One completely FOSS-compatible, not using Google Maps and using OSMDroid for distribution on FDroid, and another using Google Services.
In such situations you wish to create a drop-in MapsActivity or MapsFragment which has different internal code in each flavour, but interacts exactly the same way with the MainActitiy or the rest of the common code. Also the depending libraries could be different (and contradicting) for each flavour and variant and we need to cover them.
Finally flavours and variants can be combined to create more build types like strawberryDebug, strawberryRelease, chocolateDebug, chocolateRelease.
Laptops with Android Studio and any latest SDK (19, 20, 22) - to try it out alongside.
I am yet to finish my undergraduate studies (Electronics and Electrical Engineering), but I am an avid Android developer, an open source enthusiast, and a part time hardware tinkerer.
I have contributions to the CyanogenMod project, the Arduino IDE, and Google’s Android Open Source Project.
I love participating in hackathons, and have won 4 of them, including India’s largest - HackIndia.