Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle assemble specific flavor and build

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?

like image 207
James Avatar asked Oct 06 '15 22:10

James


People also ask

What are buildTypes and product Flavours in Gradle?

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.

What Gradle assemble does?

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.

How do I get the current flavor in Gradle?

There is no direct way to get the current flavor; the call getGradle(). getStartParameter().

What is productflavours in Gradle?

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.

What is a flexible build system like Gradle?

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.

How to check for custom fields created in Gradle build?

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.

Why is Gradle so slow on my Android?

@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.


1 Answers

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

like image 64
Sam Dozor Avatar answered Sep 21 '22 05:09

Sam Dozor