我如何prevent异常捕获的Android的? [英] How do I prevent exception catching in Android?
问题描述
我试图开发的Android应用程序,但我有困难跟踪每个例外,我得到这个过程的来源和成因。 我的code运行在一个活动,如果线路防雷导致异常的话,而不是停在该行,并强调它,它抛出我到ActivityThread类的code,这显然我没有,所以我只是得到一个找不到源代码屏幕。
I'm trying to develop an application for Android, but I'm having difficulties tracing the source and cause of each exception I get in the process. My code runs in an Activity, and if a line of mine causes an exception, then rather than stopping on that line and highlighting it, it throws me into the ActivityThread class's code, which apparently I don't have, so I just get a "Source not found" screen.
试图找出麻烦这样一行是非常令人沮丧,所以我试图找到一种方法,prevent Android的code从开发过程中捕捉每一个例外。 我的在线搜索没有取得信息,如何我去这样做,所以我决定在这里问。
Trying to find the troublesome line like this is very frustrating, so I'm trying to find a way to prevent Android's code from catching every exception during development. My searches online have yielded no information as to how I go about doing this, so I decided to ask here.
下面是异常之前堆栈跟踪被扔在我的code:
Here is the stack trace before the exception is thrown in my code:
主题[< 1>主](暂停
(断点线72 GameView))
GameView.showMenu()线:72
GameView.init()线:59
GameView(背景下,
AttributeSet中)线:51
Constructor.constructNative(对象[],
上课,下课[],INT,布尔)线:
不可用[本地方法]
Constructor.newInstance(对象...)
行:415
PhoneLayoutInflater(LayoutInflater).createView(字符串,
字符串的AttributeSet)线:505
PhoneLayoutInflater(LayoutInflater).createViewFromTag(字符串,
AttributeSet中)线:570
PhoneLayoutInflater(LayoutInflater).rInflate(XmlPullParser,
查看,AttributeSet中)线:623
PhoneLayoutInflater(LayoutInflater).inflate(XmlPullParser,
ViewGroup中,布尔)线:408
PhoneLayoutInflater(LayoutInflater).inflate(INT,
ViewGroup中,布尔)线:320
PhoneLayoutInflater(LayoutInflater).inflate(INT,
ViewGroup中)线:276
PhoneWindow.setContentView(INT)线:
207
MainActivity(活动).setContentView(INT)
行:1657
MainActivity.onCreate(捆绑)线:
20
Instrumentation.callActivityOnCreate(活动,
包)线:1047
ActivityThread.performLaunchActivity(ActivityThread $ ActivityClientRecord,
意图)线:1586
ActivityThread.handleLaunchActivity(ActivityThread $ ActivityClientRecord,
意图)线:1638
ActivityThread.access $ 1500(ActivityThread,
ActivityThread $ ActivityClientRecord,
意图)线:117
ActivityThread $ H.handleMessage(消息)
行:928
ActivityThread $ H(处理器).dispatchMessage(消息)
行:99 Looper.loop()线:123
ActivityThread.main(字符串[])线路:
3647 Method.invokeNative(对象,
[对象],上课,下课[],类,INT,
布尔)行:不可用[本地
法] Method.invoke(对象,
对象...)线:507
ZygoteInit $ MethodAndArgsCaller.run()
行:839 ZygoteInit.main(字符串[])
行:597 NativeStart.main(字符串[])
行:不可用[本地方法]
Thread [<1> main] (Suspended (breakpoint at line 72 in GameView))
GameView.showMenu() line: 72
GameView.init() line: 59
GameView.(Context, AttributeSet) line: 51
Constructor.constructNative(Object[], Class, Class[], int, boolean) line: not available [native method] Constructor.newInstance(Object...) line: 415 PhoneLayoutInflater(LayoutInflater).createView(String, String, AttributeSet) line: 505
PhoneLayoutInflater(LayoutInflater).createViewFromTag(String, AttributeSet) line: 570
PhoneLayoutInflater(LayoutInflater).rInflate(XmlPullParser, View, AttributeSet) line: 623 PhoneLayoutInflater(LayoutInflater).inflate(XmlPullParser, ViewGroup, boolean) line: 408 PhoneLayoutInflater(LayoutInflater).inflate(int, ViewGroup, boolean) line: 320 PhoneLayoutInflater(LayoutInflater).inflate(int, ViewGroup) line: 276
PhoneWindow.setContentView(int) line: 207
MainActivity(Activity).setContentView(int) line: 1657
MainActivity.onCreate(Bundle) line: 20
Instrumentation.callActivityOnCreate(Activity, Bundle) line: 1047
ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1586
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1638
ActivityThread.access$1500(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 117 ActivityThread$H.handleMessage(Message) line: 928 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) line: 3647 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 839 ZygoteInit.main(String[]) line: 597 NativeStart.main(String[]) line: not available [native method]
和这里的Eclipse之后的堆栈跟踪已停止对账户除执行:
and here is the stack trace after Eclipse has stopped execution on account of the exception:
主题[&LT; 1>主](暂停
(RuntimeException的除外))
ActivityThread.performLaunchActivity(ActivityThread $ ActivityClientRecord,
意图)线:1622
ActivityThread.handleLaunchActivity(ActivityThread $ ActivityClientRecord,
意图)线:1638
ActivityThread.access $ 1500(ActivityThread,
ActivityThread $ ActivityClientRecord,
意图)线:117
ActivityThread $ H.handleMessage(消息)
行:928
ActivityThread $ H(处理器).dispatchMessage(消息)
行:99 Looper.loop()线:123
ActivityThread.main(字符串[])线路:
3647 Method.invokeNative(对象,
[对象],上课,下课[],类,INT,
布尔)行:不可用[本地
法] Method.invoke(对象,
对象...)线:507
ZygoteInit $ MethodAndArgsCaller.run()
行:839 ZygoteInit.main(字符串[])
行:597 NativeStart.main(字符串[])
行:不可用[本地方法]
Thread [<1> main] (Suspended (exception RuntimeException)) ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1622
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1638
ActivityThread.access$1500(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 117 ActivityThread$H.handleMessage(Message) line: 928 ActivityThread$H(Handler).dispatchMessage(Message) line: 99 Looper.loop() line: 123 ActivityThread.main(String[]) line: 3647 Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method] Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 839 ZygoteInit.main(String[]) line: 597 NativeStart.main(String[]) line: not available [native method]
任何帮助将是非常美联社preciated。
Any help would be highly appreciated.
推荐答案
在调试器中断那样,只是继续执行(可能是你需要做2〜3次)。然后看LogCat中输出有意义的堆栈跟踪。
When the debugger breaks like that, just continue execution (probably you'll need to do this 2 or 3 times). Then look at the LogCat output for a meaningful stack trace.
这篇关于我如何prevent异常捕获的Android的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!