Android的Studio IDE中:中断的异常 [英] Android Studio IDE: Break on Exception

查看:411
本文介绍了Android的Studio IDE中:中断的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来我的Andr​​oid Studio不希望在默认情况下任何异常中断。关于任何异常启用破开始实际JDE库中断裂。有没有什么办法,迫使它在我的code内的例外只有突破只?

It seems my Android Studio does not want to break on any exception by default. Enabling break on "Any Exception" starts breaking within actual JDE libraries. Is there any way to force it to break only on exceptions within my code only?

从Visual Studio宇宙的到来,寻找默认VS这里调试行为。

Coming from Visual Studio universe, looking for the default VS debug behavior here.

推荐答案

打破所有异常,捕获或者未捕获:


  1. 通过的运行打开断点窗口 - >查看断点

  2. 出现断点对话框。在左窗格中,滚动至底部。选择任何异常 Java异常断点

  3. 任何异常选中,在右窗格中,配置如下:

    • 暂停:检查

    • 所有:选择

    • 条件:<!code>(此的instanceof抛出java.lang.ClassNotFoundException)

    • 通知:双方的捕捉到异常未捕获的异常

  1. Open the Breakpoints window via Run -> View Breakpoints.
  2. The Breakpoints dialog appears. In the left pane, scroll to the bottom. Select Any exception under Java Exception Breakpoints
  3. With Any exception selected, on the right pane, configure as follows:
    • Suspend: checked
    • All: selected
    • Condition: !(this instanceof java.lang.ClassNotFoundException)
    • Notifications: both Caught exception and Uncaught exception selected


  • com.myapp。* (与你的应用程序的命名空间preFIX替换此)

  • 的Java * 。(注:按OP的问题,离开这了对Java库不破)

  • Android系统。* (同​​上,离开了刚刚调试自己的应用程序code)

  • 添加任何额外的命名空间在必要时(如第三方库)

  1. Check the Class filters checkbox to enable class filtering (as mentioned by @Scott Barta). Then click the ... (elipsis) button to open the Class Filters dialog. Specify class namespace patterns by clicking on the (Add Pattern) button. Enter:
    • com.myapp.* (replace this with the namespace prefix of your app)
    • java.* (note: as per OP's question, leave this out to NOT break on Java libraries)
    • android.* (as above, leave out to just debug own app code)
    • Add any additional namespaces as necessary (e.g. 3rd party libraries)


  1. preSS 确定,然后关闭该对话框断点

  1. Press OK, then dismiss the Breakpoints dialog.

这篇关于Android的Studio IDE中:中断的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆