Questions tagged «buildconfig»

20
Gradle buildConfigField BuildConfig无法解析符号
我正在使用Gradle构建我的Android应用程序。我正在尝试根据构建类型(发布或调试)使用一些标志。 我的Gradle文件如下所示: android { buildTypes { debug { buildConfigField 'boolean', 'PREPROD', 'true' buildConfigField 'boolean', 'STAGING', 'false' } release { buildConfigField 'boolean', 'PREPROD', 'false' buildConfigField 'boolean', 'STAGING', 'false' } } } 并且,如果我尝试致电,BuildConfig.PREPROD或者BuildConfig.STAGING收到“无法解析符号”错误。Gradle同步成功,所以我不知道是否忘记了一些步骤才能使用此功能? 生成的BuildConfig.java文件如下(在中build/source/buildConfig/debug/com.example.myapp): package com.example.myapp; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.