Issue
I want to separate the behavior during debug and release in Android studio.
So I'm using Build variants
like this.
Build variants
So I added BuildConfig.DEBUG
in my code.
I called the property like below in a service method.
if (BuildConfig.DEBUG) {
Log.e(TAG, "Hello debug mode")
}
But the log output nothing. It seems the property did not be called. How to use some functions in only debug mode environment or in only release mode.
Solution
Have you checked that the import of BuildConfig is correct? Sometimes it can be using BuildConfig from a third party library and it is not the one of your project. For example
import org.koin.android.BuildConfig
Make sure the import is something like this:
import com.yourpackagename.BuildConfig
Answered By - Luis Pascual
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.