I am not getting FLAVOR string in BuildConfig , it is Missing in BuildConfig in Android Studio

1.9k Views Asked by At
 How to generate the missing one ? public static final String FLAVOR = "";`

Missing FLAVOR in BuildConfig in Android Studio.It should be like this

public final class BuildConfig {
  public static final boolean DEBUG = Boolean.parseBoolean("true");
  public static final String APPLICATION_ID = "com.arkam.konk.look";
  public static final String BUILD_TYPE = "debug";
  public static final String FLAVOR = "";
  public static final int VERSION_CODE = 1;
  public static final String VERSION_NAME = "1.0.0";
}

But in my case getting like without this one public static final String FLAVOR = "";

public final class BuildConfig {
  public static final boolean DEBUG = Boolean.parseBoolean("true");
  public static final String APPLICATION_ID = "com.arkam.konk.look";
  public static final String BUILD_TYPE = "debug";
  public static final int VERSION_CODE = 1;
  public static final String VERSION_NAME = "1.0.0";}

How to generate the missing one ???

2

There are 2 best solutions below

3
On

use : Build -> Clean Project and then File -> Invalidate Caches / Restart. and then build your App on smartphone or emulator.

EDIT : if it does't work, create a new project and copy your classes and codes in that!

0
On

Include this in the build.gradle of the module you want to show the FLAVOR string:

android {
    productFlavors {
        flavorDimensions "name"
        myFlavorName {
            dimension "name"
            buildConfigField 'boolean', 'flavorVariable1', 'false'
            buildConfigField 'String', 'flavorVariable2', '"hello world"'
            buildConfigField 'String', 'flavorVariable3', '"foo"'
        }
    }
}