Kir*_*nLy 28 debugging kotlin android-studio kotlin-coroutines
我试图调试我的协程,但放置在挂起函数中的断点不起作用。请帮助我理解为什么。
使用 Android Studio。
好的,我从 viewModelScope 启动了一个协程:
viewModelScope.launch(IO) {
when(val result = interactor.getAllWords()){...}
}
Run Code Online (Sandbox Code Playgroud)
在getAllWords()我写道:
override suspend fun getAllWords(): WordResult {
val words = mutableListOf<Word>()
when (val wordsResult = getAllWordsWithoutFiltersApplying()) {}
...
return getWordsWithSelectedPattern()
Run Code Online (Sandbox Code Playgroud)
我有两个挂起功能:getAllWordsWithoutFiltersApplying()和getWordsWithSelectedPattern()。我对它们都有一个断点,但它们没有在调试模式下触发。
同时,线 val words = mutableListOf<Word>(),当我将断点放在它的行上正在触发。
而且,如果我将一些日志内容放入“untracing”功能中,它们将起作用。我这么说是为了说明,暂停功能有效。断点不是。
我该怎么做才能调试它们?
*截图已添加。看左边有一排图标。为什么我的线路不可用?
| 归档时间: |
|
| 查看次数: |
5949 次 |
| 最近记录: |