Check Initialization: Ensure that you've properly initialized Timber in your application. It's usually done in the onCreate
method of your Application
class.
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}
}
Just make sure you are importing BuildConfig
from the correct location.
The correct way is: should be configured appropriately in your project's Gradle files
for example import com.example.appname.BuildConfig
.
If it still does not work, try import androidx.viewbinding.BuildConfig
Remember to make sure that your app's build configuration is set up correctly in your build.gradle
files to ensure that BuildConfig.DEBUG
behaves as expected. Debug and release configurations should be configured appropriately in your project's Gradle files.
Ensure that there is no space between the words in the tag. Otherwise, the tag you add to logcat will only display according to the first word. Briefly, space is not counted by logcat.