Questions tagged [android-productflavors]

A Android product flavor is a customized version of an application built by Gradle.

The Android Gradle plugin supports product flavors, which are customized versions of an application.

From the Android Gradle Plugin User Guide:

This new concept is designed to help when the differences are very minimum. If the answer to “Is this the same application?” is yes, then this is probably the way to go over Library Projects.

534 questions
475
votes
32 answers

No matching client found for package name (Google Analytics) - multiple productFlavors & buildTypes

Context: I'm trying to set up Google Analytics for my app. (having 4 custom buildTypes and more than a few productFlavors) It works fine when I select the Build Variant which has the applicationId set to com.my.app.package.name (the package name…
58
votes
5 answers

How to apply plugin to only one flavor in gradle?

I have a multi-flavored, multi-build-typed android project and I want to integrate the NewRelic plugin. But I have to apply it only for one of the customers, thus only for one product flavor. NewRelic uses instrumentation and the plugin would…
49
votes
3 answers

Product Flavor: Duplicate class found

I have a question, but I'm sitting here in front of my app since hours but I can't understand what the problem is. I have an android app (written in kotlin) and I want to make two product flavors and override a class / file in the product flavor: So…
sockeqwe
  • 14,614
  • 22
  • 78
  • 136
45
votes
3 answers

Gradle: add dependency for a specific flavour of the library

I have a library project and a application. I'd like to have 2 product flavours (store, dev) for both library and application. When I build the store flavour for the application I want to use the store flavour from the library. Also when I build the…
amarkovits
  • 756
  • 1
  • 10
  • 17
44
votes
12 answers

How to customize the APK file name for product flavors?

I am customizing the name of the APK file of my Android application within the build.gradle script as follows: android { defaultConfig { project.ext.set("archivesBaseName", "MyApplication"); } } Now that I am using product…
JJD
  • 44,755
  • 49
  • 183
  • 309
41
votes
3 answers

How to use flavors with different app names in Android studio?

In my app-level build.gradle I have the following flavors: productFlavors { originalFlavour{ } freeFlavour{ } } The thing is building both flavors I get the same App Name. Instead I would like to have different app names for each…
33
votes
5 answers

Publishing Android Library (aar) to Bintray with chosen flavors

I've juste added some flavors (or productFlavors if you want) to my project. The fact is that when I publish the library to bintray, all flavors are uploaded (which is great), but I'm unable to use them. The plugin used is the official one here.…
Hugo Gresse
  • 14,772
  • 8
  • 69
  • 103
32
votes
3 answers

Crashlytics (Fabric) separate organizations for application variants (build types, product flavors)

This is self-answered question to share my knowledge. I have a project with multiple product flavors and I want to integrate Fabric using separate organizations for each product flavor. I tried to integrate Fabric using Android Studio Fabric Plugin.…
mixel
  • 22,724
  • 10
  • 111
  • 154
32
votes
5 answers

Multiple dex files define /BuildConfig, can't find the cause:

I'm using the new gradle build system and I'm facing the following problem: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Lcom/kibo/mobi/BuildConfig; at…
Emil Adz
  • 38,699
  • 35
  • 127
  • 177
30
votes
1 answer

Android wear project with 3 flavors, 3 buildTypes and 2 applicationIdSuffixes

When I build my project after trying to combine wearApp flavors and buildTypes with applicationIdSuffixes, i get the following error message: Error:Execution failed for task ':app:handleFirstCustomerTestMicroApk'. > The main and the micro apps do…
27
votes
7 answers

How to use a different launcher activity in a product flavor?

I'm working on an Android library project, in the default src/main/AndroidManifest.xml, the MainActivity is the launcher activity. For the sake of something else, I created product flavors. Yes, it works perfect if I want to trigger / show…
Jing Li
  • 12,230
  • 4
  • 54
  • 66
24
votes
1 answer

Android studio gradle flavor dimensions build varients not working correctly

I have two dimensions of an app, call then green and blue. There will only be these two dimensions but an unlimited number of product flavors. This is the way I'm setting it up in gradle flavorDimensions "green", "blue" productFlavors { one { …
22
votes
2 answers

Android Studio: product flavor combination with more than two flavor dimensions (flavor groups)

I am developing an Android application using Android Studio (v 2.1, gradle plugin v 2.1.0). My application has various versions which share a lot of common code so I decided to use flavor dimensions and product flavors to customize code and…
21
votes
1 answer

How to define and use a constant in Gradle build script (Android)?

I'm working on an Android application with Gradle as its build system. My objective is to use a value (a package name) as an applicationId: productFlavors { orange { applicationId "com.fruits.android.orange" // ... But also to expose…
Konrad Morawski
  • 7,689
  • 6
  • 47
  • 80
19
votes
2 answers

Test package for different flavors in Android Studio

I am experimenting flavors on an application in androidstudio. I have to write different test classes for the flavors, as I have different class files for the flavors. But I wonder if there is any option to specify test packages for each flavor in…
1
2 3
35 36