I am using Gradle to create an Android application. I am trying to use some flags based on the type of assembly (release or debug).
My Gradle file looks like this:
android { buildTypes { debug { buildConfigField 'boolean', 'PREPROD', 'true' buildConfigField 'boolean', 'STAGING', 'false' } release { buildConfigField 'boolean', 'PREPROD', 'false' buildConfigField 'boolean', 'STAGING', 'false' } } }
And if I try to call BuildConfig.PREPROD or BuildConfig.STAGING , I get the error "Cannot resolve character". Gradle sync was successful, so I don’t know if I forgot some steps to be able to use this function?
The generated BuildConfig.java file is BuildConfig.java follows (in 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 PACKAGE_NAME = "com.example.myapp"; public static final String BUILD_TYPE = "debug"; public static final String FLAVOR = ""; public static final int VERSION_CODE = 400; public static final String VERSION_NAME = ""; }
android gradle
Gaëtan Mar 24 '14 at 8:47 2014-03-24 08:47
source share