Android Studio IDE - 调试步骤 Into/Over 应用程序崩溃

Android Studio IDE - Debugging Step Into/Over Crashing App

我在 Windows 10 中使用 Android Studio 4.1.3,我在调试时遇到问题。

如果不调试或在调试时使用 Resume Program,应用程序运行正常,但如果尝试逐步调试(结束、进入、退出),它会崩溃。

它发生在所有应用程序和所有测试平台(真实设备和模拟设备)和所有代码行中(例如,在 MainActivity 的 onCreate 的第一行)。

已经尝试删除所有断点,清理构建,但无法找到如何在此版本中禁用 Instant 运行。

Logcat:

04-24 10:50:41.174 24394-24397/com.cormorant.poifinder A/art: art/runtime/jdwp/jdwp_handler.cc:1187] Check failed: modifier_count < 256 (modifier_count=285, 256=256) 
04-24 10:50:41.214 24394-24397/com.cormorant.poifinder A/art: art/runtime/barrier.cc:90] Check failed: count_ == 0 (count_=-1, 0=0) Attempted to destroy barrier with non zero count
04-24 10:50:41.215 24394-24397/com.cormorant.poifinder A/art: art/runtime/runtime.cc:366] Runtime aborting --- recursively, so no thread-specific detail!
04-24 10:50:41.215 24394-24397/com.cormorant.poifinder A/art: art/runtime/runtime.cc:366] 
    
    --------- beginning of crash
04-24 10:50:41.215 24394-24397/com.cormorant.poifinder A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 24397 (JDWP)```

Have anyone any idea? Thanks.

不确定是否真的是答案,但是...

问题与从 23(未在下方测试)到 26 的 APIs 有某种关系。在此 API 的 none 中,调试(Step-Into,Over)有效,不适用于模拟设备,也不适用于物理设备。

来自 27 的

APIs 工作正常。

请注意,应用程序的 APK 是 23,使用 API 进行调试 23-26 使用 运行 和断点来获取内部方法...只是一个痛苦的地方有几十个断点....

  • 更改 compileSdkVersion android targetSdkVersion 低于 30,例如 28 或更低。
  • 然后构建和调试。
    • 效果很好。
  • 之后,您可以恢复之前设置的compileSdkVersion android targetSdkVersion
    • 效果也不错。