Timber logs are not being shown in Android Studio Dolphin 2021.3.1
Asked Answered
B

3

10

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.

Buroker answered 26/9, 2022 at 15:15 Comment(2)
I have a problem with logs on emulator, but real device gives everything.Janeyjangle
Yes I am having issue with emulator too. Seems like it is an issue with Android Studio and not Timber.Buroker
S
4

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())
}
Steiermark answered 26/5, 2023 at 11:49 Comment(0)
M
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

Mccray answered 23/1, 2023 at 3:17 Comment(3)
Hey @Mccray I can't see this option in Android Studio Electric Eel 2022.1.1. Which version are you using ?Buroker
@Buroker I also using Android Studio Electric Eel | 2022.1.1Mccray
I was using Android Studio Electric Eel also. but now using Android Studio Flamingo | 2022.2.1 Patch 2Mccray
E
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>
Episcopacy answered 12/3, 2023 at 7:25 Comment(2)
Hi @Ad. Asaduzzaman, This was done in the project. The issue was due to Android Studio which has been fixed in new releases.Buroker
@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.Episcopacy

© 2022 - 2024 — McMap. All rights reserved.