Search code examples
androiddebugginglogginglogcat

I can't see my log calls in LogCat - Android Studio


I'm just a beginner in Android and Kotlin. All I want is to see the output of a few values. I've been trying for 2 days but I couldn't succeed.

I'm trying to make an image carousel. Here is the place I use for the log;

...

LaunchedEffect(key1 = pagerState.currentPage) {
    delay(autoSlideDuration)
    var newPosition = pagerState.currentPage + 1
    if (newPosition > itemsCount - 1) newPosition = 0
    pagerState.animateScrollToPage(newPosition)
    Timber.tag("EXAMPLE_TAG").d("Current Value --> %s", newPosition)
    //println("Some text here")
    //Log.d("EXAMPLE_TAG", "Current Value --> $newPosition")
}

...

As you can see I used 3 types of log code. But none of them appear in LogCat.

I also read all the comments in this thread: Logcat not displaying my log calls. Tried all posted solutions but it didn't work.

My Android Studio Version: Android Studio Electric Eel | 2022.1.1 Patch 2

Android SDK Platform-Tools Version: 34.0.1

enter image description here

enter image description here

Edit (2023/04/02)

I found that the problem was caused by LaunchedEffect. When I use Log.d outside of the code, the log appears on the LogCat screen.


Solution

  • I was stupid for asking here without trying the log.d command outside of LaunchedEffect.

    I found that the problem was caused by LaunchedEffect. When I use Log.d outside of the code, the log appears on the LogCat screen.

    So the problem is not LogCat, it's LaunchedEffect. That's why I'm closing the question.