我在BuildConfig中没有得到FLAVOR字符串,它在Android Studio的BuildConfig中丢失


How to generate the missing one ? public static final String FLAVOR = "";`

Android Studio中BuildConfig中缺少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 String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0.0";
}

但在我的情况下,没有这个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";}

如何生成缺失的???

使用:构建->清除项目,然后清除文件->使缓存无效/重新启动。然后在智能手机或模拟器上构建应用程序。

编辑:如果不起作用,请创建一个新项目,并在其中复制您的类和代码!

将其包含在要显示FLAVOR字符串的模块的build.gradle中:

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

相关内容

  • 没有找到相关文章

最新更新