When looking at the BuildConfig
class generated by Android Studio and the Gradle plugin one can see that the BuildConfig.DEBUG
field is initialized using the Boolean.parseBoolean(String)
call instead of using one of the boolean literals true
or false
.
When I add custom build properties using Gradle I would simply do it like this:
android {
buildTypes.debug.buildConfigField 'boolean', 'SOME_SETTING', 'true'
}
But looking at the generated BuildConfig
tells me that Google has taken a different approach with the DEBUG
flag:
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
// more fields here
// Fields from build type: debug
public static final boolean SOME_SETTING = true;
}
What is the benefit of using Boolean.parseBoolean(String)
instead of literals?