Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to view exception details while debugging Android in Eclipse?
    text
    copied!<p>I've just started learning how to develop applications for Android. Currently, I am using <a href="http://en.wikipedia.org/wiki/Eclipse_%28software%29" rel="nofollow">Eclipse 4.2</a> (Juno) as the <a href="http://en.wikipedia.org/wiki/Integrated_development_environment" rel="nofollow">IDE</a>. The problem is I can't see a normal way to view exceptions that are happening in my own code. For example:</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); List&lt;BasicObject&gt; objects = _objectRepository.GetAllObjects(); Iterator&lt;BasicObject&gt; iterator = objects.iterator(); while(iterator.hasNext()) { ObjectListItemView itemView= new ObjectListItemView(this,iterator.next()); } } </code></pre> <p>At the time when <code>onCreate</code> is running, _objectRepository is null and so the NullReference is thrown. After that Eclipse displays "Source not found", which is really not what I expect. Then I press <kbd>F8</kbd> (continue) multiple times; the process exits and the debugger stops. And only after that can I see some stacktrace in LogCat (from where it's really hard to navigate to my own code).</p> <p>As you can see, all this process of catching exceptions is really time-consuming. Is there any other way to view exceptions and what am I doing wrong?</p> <p>I am not using an Android emulator, I am using a real device (<a href="http://en.wikipedia.org/wiki/HTC_Desire_S" rel="nofollow">HTC Desire S</a>). I already have LogCat, but I'd like something more handy/practical.</p> <p>To illustrate, in Visual Studio I can see an exception while debugging. Visual Studio sets a break on the line where the exception occurred and I can view any information I want (stack trace local variables, all stuff actually) in the exception window (see <em><a href="http://www.codehappiness.com/post/Debug-Exceptions-window.aspx" rel="nofollow">The {not much utilized} Debug->Exceptions… window technique</a></em>).</p> <p>In Eclipse I got exception details in LogCat (which is very uncomfortable to use) and only after the debugger is stopped.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload