1

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.

Can
  • 83
  • 12

2 Answers2

3

Are you sure you are not using the new logcat?

try using tag:EXAMPLE_TAG or package:mine for more info check out

JustSightseeing
  • 1,460
  • 3
  • 17
  • 37
  • Result for `package:mine` : https://i.imgur.com/LJnUDbP.png -- Result for `tag:EXAMPLE_TAG` : https://i.imgur.com/yykBkm7.png and i dont know how to see LogCat version. – Can Mar 23 '23 at 23:29
  • Yea, you are definitevely using the new logcat version – JustSightseeing Mar 24 '23 at 18:36
  • update: this seems to be a bug related to the canary 10: https://issuetracker.google.com/issues/273600331#comment6 – JustSightseeing Mar 27 '23 at 18:39
  • @JustSightseeing Which version of Android Studio are you using? If you are using Giraffe Canary, have you tried Flamingo Beta or Electric Eel stable to see if they have the same behavior? – Code-Apprentice Apr 02 '23 at 18:50
0

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.

Can
  • 83
  • 12