7

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.

oyeraghib
  • 878
  • 3
  • 8
  • 26

3 Answers3

1

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())
}
flopshot
  • 1,153
  • 1
  • 16
  • 23
0

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

fahrizal89
  • 598
  • 5
  • 13
0

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>
Md. Asaduzzaman
  • 14,963
  • 2
  • 34
  • 46
  • Hi @Ad. Asaduzzaman, This was done in the project. The issue was due to Android Studio which has been fixed in new releases. – oyeraghib Mar 12 '23 at 08:34
  • @oyeraghib, Thanks for the info. Actually, that was missing in my old project. Hence I added it here so that no one can ignore it. – Md. Asaduzzaman Mar 12 '23 at 12:04