Timber log is not printing in debug console or Logcat

initialization Timber in Kotlin

class ExampleApplication : Application(){

    override fun onCreate() {
        super.onCreate()
        // init timber
        if (BuildConfig.DEBUG) {
            Timber.plant(Timber.DebugTree())
        }
    }
}

and don't forget write android:name of Application in Manifest.xml:

<application
        android:name=".ExampleApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.PostMakerMassive">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

If you're initializing Timber like this:

if (BuildConfig.DEBUG) {
    Timber.plant(Timber.DebugTree())
}

Be sure, that you're imported BuildConfig from your app package, and not something like BuildConfig's from 3rd party libraries like this: import org.koin.android.BuildConfig. I strugled with this a few times.


Make sure that you have initialised Timber in Application class. Following code might help :-

public class MyApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        // This will initialise Timber
        if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
        }
   }
}