Sean's Note: [Android Studio 1.2.2] Debugger stuck

2015年7月22日 星期三

[Android Studio 1.2.2] Debugger stuck

最近開始改用 Android Studio,卻發現 debug 的時候常常卡住,
但 Android Studio 本身並沒有 hang, 後來發現網路上有很多人 report Google 這支 issue,
其中 issue 172523 裡有 Google 人員提到暫時的 workaround 方法:

"For anyone else who might encounter this issue, here is a summary:

The issue shows up in one of two ways: Studio will be responsive, but the debugger will be stuck at either "Collecting Data.." or "Waiting for last debugger command to complete..". This happens on both Dalivk and ART, so all versions of the platform are affected. The issue is more prevalent with Studio 1.2, but exists on all versions of Studio.

The correct fix for this issue is in the platform. The next version of M preview is likely to have this fix (in progress CL here: https://android-review.googlesource.com/#/c/152715/)

Until then we have some workarounds which reduce the probability of hitting this issue. So if you encounter this issue, you can try one of the following:

1. Change your breakpoint to only suspend the thread where it is hit rather than all threads. See comment #82 for more info on how to do this. The next release of Studio 1.2 and Studio 1.3 will be make this the default. (https://android-review.googlesource.com/#/c/152715/)

2. You can turn off various settings in the debugger that invoke methods: These include:
  a) inline debugging (https://www.jetbrains.com/idea/help/inline-debugging.html)
  b) "Enable 'toString()' object view" (Settings | Debugger | Data Views | Java)
  c) "Enable alternative view for Collections classes" (Settings | Debugger | Data Views | Java)

The 2nd option is more severe (it limits the amount of automation the debugger does for you), so we are not enabling that by default. However, if you still see the issue after changing the suspend policy to thread only, then unfortunately, you'll have to do the steps in 2 as well.

Finally, if you still see the issue after both, then that would be a new bug. Please file a new bug with a test case.

Thanks everyone for your patience and your help in providing us with repro cases and stack traces."


結論是 2.a 的 workaround 似乎可行。

沒有留言:

張貼留言