android studio break,Android Studio IDE: Break on Exception

可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):

问题:

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?

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

回答1:

To break on all exceptions, caught or uncaught:

Open the Breakpoints window via Run -> View Breakpoints.

The Breakpoints dialog appears. In the left pane, scroll to the bottom. Select Any exception under Java Exception Breakpoints

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

6c1555302777729326ca3efa0910d9ec.png

Define filters that specify namespaces of libraries that the debugger should break on: 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

6c1555302777729326ca3efa0910d9ec.png (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)

6c1555302777729326ca3efa0910d9ec.png

Press OK, then dismiss the Breakpoints dialog.

回答2:

If you open up the Breakpoints window, it gives you quite a few options to have it conditionally break or not. What you're looking for is the "Class filters" here -- you can specify a wildcard expression with, for example, a Java package path, and it will only break for exceptions generated from matching classes.

回答3:

To break on all exceptions in your code and other exceptions if uncaught:

This methods filters out the exception types that the runtime throws during normal operation (not very exceptional, are they?). It doesn't use the class filter, since it would filter out too much; bugs in your code often cause runtime classes to throw exceptions (e.g. accessing an array list past the end).

Enable Java Exception BreakPoints / Any exception for uncaught exceptions only.

Add a new Java Exception BreakPoint for the Exception (java.lang) class for caught and uncaught exceptions. Enable Condition and set it to this:

!(this instanceof java.lang.ClassNotFoundException || this instanceof android.system.ErrnoException || this instanceof java.io.FileNotFoundException || this instanceof javax.net.ssl.SSLHandshakeException || this instanceof javax.net.ssl.SSLPeerUnverifiedException || this instanceof android.system.GaiException || this instanceof java.net.SocketTimeoutException || this instanceof java.net.SocketException || this instanceof java.security.NoSuchAlgorithmException)

Add to the exclusion list in the condition any other non-exceptional exceptions you encounter. (BTW, using java.lang.Exception is a way of effectively getting a second "Any exception" entry.)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/557747.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

SpringBoot怎么直接访问templates下的html页面

SpringBoot直接访问templates下的html问题 方法1:曾经: template下文件不允许直接访问 1、springboot项目默认是不允许直接访问template下的文件的,是受保护的。 所以想访问template下的html页面,我们可以配置视图解析器。 2、如…

php查到的内容追加到html,javascript - 请问php中如何将查询出来的结果数组转化成自己想要的格式,并在前台利用js输出到html中...

考试类型的表jx_exam_type,可后台添加内容考试成绩的表jx_result,可后台添加内容期中考试成绩表中的exam_id对应考试类型表中的id,也就是添加的成绩是属于期中还是期末然后使用php查询$sql"SELECT re.type, re.score, re.exam_id, et.ti…

DevOps(过程、方法与系统的统称)是什么

DevOps (过程、方法与系统的统称) DevOps(Development和Operations的组合词)是一组过程、方法与系统的统称,用于促进开发(应用程序/软件工程)、技术运营和质量保障(QA)部…

android 蓝牙sco stream_voice_call,android TTS输出总是要 A2DP_android_开发99编程知识库

大多数设备上我都有这样的工作。 下面是在语音呼叫流中使用蓝牙SCO代替A2DP启动TTS的部分。if (mTtsReady) {myHash new HashMap();myHash.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID,"A2DP_Vol");OLD_AUDIO_MODE am2.getMode();if(SMSstream 1){if (am2.is…

Springboot 页面访问不到静态资源Failed to load resource: the server responded with a status of 404 ()

Springboot 页面访问不到静态资源 问题&#xff1a;在HTML文件中引入图片&#xff0c;但是浏览器访问不到图片。 index.html&#xff1a; <!DOCTYPE html> <html xmlns:th"http://www.thymeleaf.org"><head><meta charset"UTF-8"&…

dw中HTML修改背景图片,dreamweaver将一个图片设定背景,用代码怎么写?

在你要改背景的文件夹中(包括硬盘分区也是一样)建立记事本&#xff0c;储存为desktop.ini 格式的&#xff0c;打开记事本编辑,输入一下源码:[ExtShellFolderViews]{BE098140-A513-11D0-A3A4-00C04FD706EC}{BE098140-A513-11D0-A3A4-00C04FD706EC}[{BE098140-A513-11D0-A3A4-00C…

spring.mvc.static-path-pattern、spring.resources.static-locations

“spring.mvc.static-path-pattern”用于阐述HTTP请求地址&#xff0c;请求非controller地址&#xff0c;如js,css,img等访问路径需要加上static, 可以不配置也能访问图片 而“spring.resources.static-locations”则用于描述静态资源的存放位置。多个路径&#xff08;逗号隔开…

JS在html中加法器,JavaScript_JavaScript程序设计之JS调试,本文主要通过一个加法器,介 - phpStudy...

JavaScript程序设计之JS调试本文主要通过一个加法器&#xff0c;介绍JS如何调试。先上代码&#xff1a;效果&#xff1a;test.html&#xff1a;计算器计算器计算demo.js/*** Created by yanzi on 15/12/8.*/var num1 document.getElementById("num1"),num2 documen…

springboot页面中静态图片路径

目录结构&#xff1a; 不写th:src"{/images/a.jpeg}"是访问不到的

html字居右垂直设置,css文字水平垂直居中怎么设置?

css文字水平垂直居中怎么设置&#xff1f;下面本篇文章就来给大家介绍使用CSS设置文字水平居中和垂直居中的方法。有一定的参考价值&#xff0c;有需要的朋友可以参考一下&#xff0c;希望对大家有所帮助。1、文字水平居中在CSS中想要让文字水平居中&#xff0c;可以使用text-a…

java实现把数据写入到Excel并下载

引入依赖&#xff1a; <!-- https://mvnrepository.com/artifact/org.apache.poi/poi --><dependency><groupId>org.apache.poi</groupId><artifactId>poi</artifactId><version>4.1.0</version></dependency>RequestM…

html5中api有什么,HTML5中的API概览

HTML5中的API概览整理一下HTML5中的常见API。前言HTML5中提供了一些功能强大的API&#xff0c;在不考虑兼容性的情况下&#xff0c;比起原生js实现更加简单&#xff0c;比起jQuery可以少引入包&#xff0c;这里整理几个常用的。一、获取页面元素及类名操作和自定义属性1. 获取页…

js参数长度太长问题 UUID字符串作为js的参数———Uncaught SyntaxError: Invalid or unexpected token

今天写程序时将id作为参数传递到js函数中&#xff0c;发现一个长度为36的字符串无法传进&#xff0c;会提示 Uncaught SyntaxError: Invalid or unexpected token 错误&#xff0c;在网上搜发现时因为参数长度太长&#xff0c;系统提示少符号&#xff0c;解决方法如下 在实际…

计算机主机声音怎么办,电脑主机声音大怎么解决 电脑主机嗡嗡响是怎么回事...

如果你经常使用电脑&#xff0c;那么主机声音大的情况你肯定遇到过&#xff0c;这就是电脑老化的表现&#xff0c;说明主机内部有了很多灰尘&#xff0c;如果平时没有注意保养&#xff0c;那么就会早主机声音很大的问题&#xff0c;怎么解决呢?很简单&#xff0c;清理主机吧&a…

springboot的thymeleaf一个页面中引入其它页面

引入页面内容&#xff08;copy为自定义的&#xff09; <div th:fragment"copy">这是引入内容</div>引入方式&#xff08;footer为引入页面名称&#xff09; <div th:include"footer::copy"></div>

计算机组成原理知识点白中英,计算机组成原理重点整理(白中英版) 考试必备

计算机组成原理重点整理(白中英版) 考试必备 一、 浮点存储&#xff1a;1&#xff0e;若浮点数 x 的 754 标准存储格式为(41360000)16&#xff0c;求其浮点数的十进制数值。解&#xff1a;将 16 进制数展开后&#xff0c;可得二制数格式为0 100 00010 011 0110 0000 0000 0…

注解@Slf4j的使用

注解Slf4j的使用 声明:如果不想每次都写private final Logger logger LoggerFactory.getLogger(当前类名.class); 可以用注解Slf4j; 1.使用idea首先需要安装Lombok插件; 2.在pom文件加入lombok的依赖 <dependency><groupId>org.projectlombok</groupId>&…

东大18春计算机基础在线作业,东大18春学期《计算机基础》在线作业123满分答案...

【奥鹏】[东北大学]18春学期《计算机基础》在线作业1试卷总分:100 得分:100第1题,双击“资源管理器”或“我的电脑”中某Word文件名(或图标)&#xff0c;将()A、启动Word程序&#xff0c;并自动建立一个名为“文档1”的新文档B、启动Word程序&#xff0c;并打开此文档C、在打印…

周昆 浙江大学计算机学院院长,浙江大学周昆教授来校作学术报告

校园网讯 10月30日上午&#xff0c;教育部长江学者特聘教授、国家杰出青年科学基金获得者、IEEE Fellow、浙江大学计算机辅助设计与图形学国家重点实验室主任、博士生导师周昆教授应邀来我院作题为“智能图形学&#xff1a;智能时代计算机图形学的机遇和挑战”的学术报告&#…

拦截器原理多个拦截器执行顺序

拦截器原理多个拦截器执行顺序 1、根据当前请求&#xff0c;找到**HandlerExecutionChain【可以处理请求的handler以及handler的所有 拦截器】 2、先来顺序执行 所有拦截器的 preHandle方法 1、如果当前拦截器prehandler返回为true。则执行下一个拦截器的preHandle2、如果当…