Running ./gradlew tasks
shows options to assemble all builds for a particular flavor, or all flavors for a particular build. Does there exist an option to assemble for a specific flavor and build combination?
Once the new project is created, by default it consists of two build types/variants - debug, release. Debug is the build type that is used when we run the application from the IDE directly onto a device. A release is the build type that requires you to sign the APK.
Android Studio uses Gradle, an advanced build toolkit, to automate and manage the build process, while allowing you to define flexible custom build configurations. Each build configuration can define its own set of code and resources, while reusing the parts common to all versions of your app.
There is no direct way to get the current flavor; the call getGradle(). getStartParameter().
Till Gradle introduced ProductFlavours we were only able to build application with the a single configuration or default configuration. Since the introduction of ProductFlavours, we are able to create variables based on build types.
A flexible build system like Gradle and its Android specific plugin allows us to configure builds for different versions of the application. Versions of app could be based on deployment environments (dev, qa, prod) or products (free, paid) or device (phone, tv, wear) on which app is running on.
During build time, Gradle generates the BuildConfig.java class in which you can check and confirm for custom fields like, BASE_URL created using the buildConfigField () Extracting the configurable items from the code base to build scripts is one of the important process in defining ProductFlovours in build.gradle.
@Zainodis: This answer is over a year old, and it is possible that they have added a task that assembles the debug build type for all product flavors. @Zainodis: It should slow down some now that Gradle for Android 1.0 has shipped. Show activity on this post.
Yes - you're referring to a specific build variant
./gradlew assembleFlavoraBuildb
Where your flavor is called flavora
and your build is buildb
Read more here: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Building-and-Tasks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With