英文:
I am not getting FLAVOR string in BuildConfig , it is Missing in BuildConfig in Android Studio
问题
缺少的部分是: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 String FLAVOR = ""; // 这部分缺失
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0.0";
}
如何生成缺失的部分?
英文:
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 ???
答案1
得分: 1
使用:Build -> Clean Project然后File -> Invalidate Caches / Restart。然后在智能手机或模拟器上构建您的应用程序。
编辑:
如果不起作用,请创建一个新项目并将您的类和代码复制到其中!
英文:
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!
答案2
得分: 0
将以下内容包含在您要显示FLAVOR字符串的模块的build.gradle中:
android {
productFlavors {
flavorDimensions "name"
myFlavorName {
dimension "name"
buildConfigField 'boolean', 'flavorVariable1', 'false'
buildConfigField 'String', 'flavorVariable2', '"hello world"'
buildConfigField 'String', 'flavorVariable3', '"foo"'
}
}
}
英文:
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"'
}
}
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论