BuildConfig.DEBUG always return false

Ensure the auto import statement of build config on the top of your class belongs to your project.

com.your.package.name.BuildConfig

the BuildConfig import might belong to a released library there DEBUG is 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.