Android アプリケーションの開発中に、例外が発生する状況に直面することがありますが、スタックをたどることができません。そのような瞬間に表示されるスタックには、システム メソッドのみが記述されており、コード行は記述されていないためです。たとえば、誤って間違った文字列を Float.parseFloat に渡すと、次のようになります。
Thread [<1> main] (Suspended)
LoadedApk$ReceiverDispatcher$Args.run() line: 710
ActivityThread$H(Handler).handleCallback(Message) line: 587
ActivityThread$H(Handler).dispatchMessage(Message) line: 92
Looper.loop() line: 123
ActivityThread.main(String[]) line: 3729
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 874
ZygoteInit.main(String[]) line: 632
NativeStart.main(String[]) line: not available [native method]
この:
Thread [<1> main] (Suspended (exception RuntimeException))
LoadedApk$ReceiverDispatcher$Args.run() line: 722
ActivityThread$H(Handler).handleCallback(Message) line: 587
ActivityThread$H(Handler).dispatchMessage(Message) line: 92
Looper.loop() line: 123
ActivityThread.main(String[]) line: 3729
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 507
ZygoteInit$MethodAndArgsCaller.run() line: 874
ZygoteInit.main(String[]) line: 632
NativeStart.main(String[]) line: not available [native method]
問題は、問題の原因となっているコード行を特定するにはどうすればよいかということです。parseFloat の使い方が間違っている場合は、スタック内の parseFloat と、呼び出しを含むメソッドに言及されているはずです。