Android Studio跳过断点

我遇到了Android Studio跳过我的断点的问题。 我之前没有遇到过这个问题,最近才开始发生。

我在MAC上运行Android Studio 2.3.1,没有特殊的插件。 有任何想法吗? 这里是代码:

private fun getLatestZip(): File? { var fileName = context.fileList().find { it.toUpperCase().contains("MBTA_GTFS") } var dateTime = getGftsTimestamp() var file: File? if (dateTime == null) { file = downloadLatestGfts() // skips the break on this line if (file != null) { printGftsTimestamp() } else { Timber.e("Failed to download Gfts") // and goes straight to here } } else if (!fileName.isNullOrEmpty()) {.... 

编辑—这是一个视频,告诉你到底发生了什么事。 这可能是一个kotlin问题。 https://youtu.be/fJOIzD8ckv8

您需要在downloadLatestGfts()函数中放置断点,或按F8进入下一行(即file null check if语句)。

尝试运行代码把一个断点上线

 if (dateTime == null) 

并检查dateTime的值是否为空。 这可能是因为空值,控制直接到其他条件。