Timber logs are not being shown in Android Studio Dolphin 2021.3.1

855 Views Asked by At

Timber logs are not visible in Android Studio Dolphin 2021.3.1

Log Statements

Timber.d("onCreateViewCalled using Timber")
Log.d("Login", "onCreateViewCalled using Log")

OUTPUT

enter image description here

Only the Log library logs are visible and not the Timber ones.

3

There are 3 best solutions below

3
fahrizal89 On

I have solved the issue by enabling Use libusb backend. Navigate to Android Studio -> Preferences -> Build, Execution, Deployment -> Debugger -> then check Use libusb backend

enter image description here

2
Md. Asaduzzaman On

Added this for future reference

You have to plant a timber debug tree by initializing Timber in the Application Class:

class MyApplication : Application() {
    
    override fun onCreate() {
        super.onCreate()
    
        if(BuildConfig.DEBUG){
            Timber.plant(Timber.DebugTree())
        }
    }
}

Add the MyApplication class to the AndroidManifest.xml like below:

<application
    android:name=".MyApplication">

    ...

</application>
0
flopshot On

Make sure you're using your app module's BuildConfig

if (com.my.app.BuildConfig.DEBUG) {
    Timber.plant(Timber.DebugTree())
}

I was using the wrong one

if (org.koin.android.BuildConfig.DEBUG) { // <- NOT MY CONFIG
    Timber.plant(Timber.DebugTree())
}