BuildConfig.DEBUG always return false BuildConfig.DEBUG always return false android android

BuildConfig.DEBUG always return false


Check imports in the class, make sure you are using correct BuildConfig path. You may use BuildConfig not from your app, but from some library.


In your Android Studio build variant are you on debug variant?

That is applied when you use flavors, either for debug or release.

in the debug mode, BuildConfig.BUILD is true, and in the release mode, it is false.


If that code is in a library, then it'll always be false, thanks to a 3-year-old bug in gradle.