在Android中调试Kotlins协程

时间:2018-06-21 06:57:41

标签: android debugging kotlinx.coroutines

是否可以在Android中调试协程?当我尝试调试此代码段时:

runBlocking {
        try {
            async(CommonPool) {
                showLoadingIndicator()
                val a = loadData().await()
                hideLoadingIndicator()
            }
        } catch (e: Exception) {
            Log.e("lala", "exception " + e.toString())
        }
}

val a显示以下消息:Cannot find local variable: name = a

在我的应用中,我按如下所示设置协程调试的属性:

System.setProperty("kotlinx.coroutines.debug", if (BuildConfig.DEBUG) "on" else "off")

仍然无法正常工作。现在我不知道在使用协同程序时如何使用调试器。 你们可以帮我吗?

预先感谢

阿尔班

0 个答案:

没有答案