title: How do I get the error line number in my Android application?
body: <p>Currently when my application has an error I get a stack trace that I don't recognize at all (doesn't contain any of the classes I defined), so debugging requires always adding at least 1 break point to then trace execution through my code.</p>
  
  <p>How can I set up Eclipse so that when an error happens I get the line number in my actual application that caused the error? (thereby giving me a better chance of fixing right away without going through additional debug steps)</p>
  
  <p>Copied below is the stack trace that I don't recgonize. I tried pausing the other threads in case my code was somewhere in there, but it's nowhere to be found.</p>
  
  <pre><code>GoogleImageSearch [Android Application] 
  DalvikVM[localhost:8606]    
      Thread [&lt;1&gt; main] (Suspended)   
          &lt;VM does not provide monitor information&gt;   
          ViewRootImpl.performMeasure(int, int) line: 2135    
          ViewRootImpl.measureHierarchy(View, WindowManager$LayoutParams, Resources, int, int) line: 1286 
          ViewRootImpl.performTraversals() line: 1497 
          ViewRootImpl.doTraversal() line: 1183   
          ViewRootImpl$TraversalRunnable.run() line: 4863 
          Choreographer$CallbackRecord.run(long) line: 749    
          Choreographer.doCallbacks(int, long) line: 562  
          Choreographer.doFrame(long, int) line: 532  
          Choreographer$FrameDisplayEventReceiver.run() line: 735 
          Handler.handleCallback(Message) line: 725   
          Choreographer$FrameHandler(Handler).dispatchMessage(Message) line: 92   
          Looper.loop() line: 137 
          ActivityThread.main(String[]) line: 5328    
          Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
          Method.invoke(Object, Object...) line: 511  
          ZygoteInit$MethodAndArgsCaller.run() line: 1102 
          ZygoteInit.main(String[]) line: 869 
          NativeStart.main(String[]) line: not available [native method]  
      Thread [&lt;10&gt; Binder_2] (Suspended)  
          &lt;VM does not provide monitor information&gt;   
          NativeStart.run() line: not available [native method]   
      Thread [&lt;9&gt; Binder_1] (Suspended)   
          &lt;VM does not provide monitor information&gt;   
          NativeStart.run() line: not available [native method]   
  </code></pre>
  
  <p><strong>Edit</strong>: To address the possibility that it's something unique to my application that was causing my sources to be missing from the stack trace, I created a HelloWorld application using Eclipse's New Android Application wizard. It ran fine with a blank screen. Then I added one line to <code>MainActivity</code>'s <code>onCreate</code>: <code>long l = 100 / 0</code>. I then got this (note that MainActivity.java does not appear anywhere in the stack, which makes me wonder what value showing the stack information provides at all. There must be a way to customize this.)</p>
  
  <pre><code>HelloWorld [Android Application]    
  DalvikVM[localhost:8611]    
      Thread [&lt;1&gt; main] (Suspended (exception RuntimeException))  
          &lt;VM does not provide monitor information&gt;   
          ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2247    
          ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2297 
          ActivityThread.access$700(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 152    
          ActivityThread$H.handleMessage(Message) line: 1282  
          ActivityThread$H(Handler).dispatchMessage(Message) line: 99 
          Looper.loop() line: 137 
          ActivityThread.main(String[]) line: 5328    
          Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]  
          Method.invoke(Object, Object...) line: 511  
          ZygoteInit$MethodAndArgsCaller.run() line: 1102 
          ZygoteInit.main(String[]) line: 869 
          NativeStart.main(String[]) line: not available [native method]  
      Thread [&lt;10&gt; Binder_2] (Suspended)  
          &lt;VM does not provide monitor information&gt;   
          NativeStart.run() line: not available [native method]   
      Thread [&lt;9&gt; Binder_1] (Suspended)   
          &lt;VM does not provide monitor information&gt;   
          NativeStart.run() line: not available [native method]   
  </code></pre>
  
  <p><strong>FINAL_EDIT</strong>: This question is based on a erroneous assumption about the debuggers ability to detect errors and suspend threads accordingly. It may suspend the thread way before LogCat has been used to report on any errors. LogCat may have worked just fine in all my previous cases listed above if I'd just continued resuming threads until the application terminates with an error.</p>