Boolean literals inside the BuildConfig class are going to issue IDE warnings when they are used in your code (at least in Android Studio). For example, when used in a boolean expression, Android Studio (by mistake) recommends simplifying the logical expression, because the constant value is always the same (for the current version of the assembly, which is).

This warning occurs only because Android Studio does not know that the final value inside BuildConfig.SOME_SETTING may differ for other build options.
To keep the code clean and free of warnings, you can tell Android Studio to ignore this particular warning by adding an IDE comment as follows:

But again, this will add some noise to the code and reduce readability. Using the Boolean.parseBoolean(String) method to initialize your constant field, you actually bypass Android Studio, which will no longer be able to fully analyze your Boolean expressions, thereby generating no more warnings.

This approach is very useful because it keeps your code clean and readable without disabling important code analysis and generating warnings.
david.schreiber
source share