It seems that all logcat logs from within kotlin coroutines are swallowed. Is there a way to see logcat logs that are printed from within a coroutine?
It seems that all logcat logs from within kotlin coroutines are swallowed. Is there a way to see logcat logs that are printed from within a coroutine?
It seems that all logcat logs from within kotlin coroutines are swallowed
Not normally. Normally, they work fine.
I just created a scrap Android Studio Arctic Fox project, using the Empty Activity template. I added implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1' to the dependencies, and I changed MainActivity to be:
package com.commonsware.myapplication
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
GlobalScope.launch(Dispatchers.Default) {
Log.d("MyApplication", "um, hi!")
}
}
}
(GlobalScope is not a good choice in real work, but I wanted to minimize any hassle)
My Log.d() call worked just fine.
You might try reproducing this experiment and see what you get. Perhaps there is something tied to your environment, your project, or your particular use of coroutines that is causing your problems.