title: Why is Android closing the application without showing the "<application> has stopped unexpectedly" message?
body: <p>I am in the process of learning Android development and was trying to crash my application at runtime. I made a button that calls a method when clicked and then made sure that the method does not exist.</p>
  
  <p>The application starts up fine. As soon as i click the button, the application closes just as intended. The only unexpected thing was that my device did not show any error message like application has closed unexpectedly or that the application force closed.</p>
  
  <p>Did I accidentally turn off some setting in the Developer Options or is it just my device that doesn't like showing error messages ? Any more information needed ?</p>
  
  <p>activity_main.xml :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:id="@+id/activity_main"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      android:orientation="vertical"
      tools:context="com.example.android.justjava.MainActivity"&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Quantity"
          android:textAllCaps="true" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/quantity_text_view"
          android:layout_marginBottom="16dp"
          android:layout_marginTop="16dp"
          android:textColor="#000000"
          android:text="0"
          android:textSize="16sp" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Price"
          android:textAllCaps="true" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/price_text_view"
          android:layout_marginBottom="16dp"
          android:layout_marginTop="16dp"
          android:textColor="#000000"
          android:text="$0"
          android:textSize="16sp" /&gt;
  
  
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:textAllCaps="true"
          android:text="ORDER"
          android:onClick="submitOrder"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>MainActivity.java:</p>
  
  <pre><code>package com.example.android.justjava;
  
  import android.os.Bundle;
  import android.support.v7.app.AppCompatActivity;
  import android.view.View;
  import android.widget.TextView;
  
  import java.text.NumberFormat;
  
  /**
   * This app displays an order form to order coffee.
   */
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      /**
       * This method is called when the order button is clicked.
       */
      public void submitOrders(View view) {
          int quantity = 5 ;
          display(quantity) ;
          displayPrice(quantity * 50) ;
      }
  
      /**
       * This method displays the given quantity value on the screen.
       */
      private void display(int number) {
          TextView quantityTextView = (TextView) findViewById(R.id.quantity_text_view);
          quantityTextView.setText("" + number);
      }
  
      private void displayPrice(int number) {
         TextView priceTextView = (TextView) findViewById(R.id.price_text_view);
          priceTextView.setText(NumberFormat.getCurrencyInstance().format(number));
      }
  }
  </code></pre>
  
  <p>Logcat:</p>
  
  <blockquote>
    <p>01-20 16:08:54.087 28870-28893/? I/OpenGLRenderer: Initialized EGL,
    version 1.4 01-20 16:08:54.087 28870-28893/? D/OpenGLRenderer: Swap
    behavior 1 01-20 16:08:58.044 28870-28870/com.example.android.justjava
    V/BoostFramework: BoostFramework() : mPerf =
    com.qualcomm.qti.Performance@b82000f 01-20 16:08:58.119
    28870-28870/com.example.android.justjava D/AndroidRuntime: Shutting
    down VM 01-20 16:08:58.120 28870-28870/com.example.android.justjava
    E/AndroidRuntime: FATAL EXCEPTION: main
                                                                                  Process: com.example.android.justjava, PID: 28870
                                                                                  java.lang.IllegalStateException: Could not find method
    submitOrder(View) in a parent or ancestor Context for android:onClick
    attribute defined on view class
    android.support.v7.widget.AppCompatButton
                                                                                      at
    android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:327)
                                                                                      at
    android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:284)
                                                                                      at android.view.View.performClick(View.java:5642)
                                                                                      at android.view.View$PerformClick.run(View.java:22338)
                                                                                      at android.os.Handler.handleCallback(Handler.java:751)
                                                                                      at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                      at android.os.Looper.loop(Looper.java:154)
                                                                                      at android.app.ActivityThread.main(ActivityThread.java:6209)
                                                                                      at java.lang.reflect.Method.invoke(Native Method)
                                                                                      at
    com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
                                                                                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 01-20
    16:08:58.120 28870-28870/com.example.android.justjava D/AppTracker:
    App Event: crash 01-20 16:08:58.132 28870-28870/? I/Process: Sending
    signal. PID: 28870 SIG: 9</p>
  </blockquote>
  
  <p>It's based on <a href="https://classroom.udacity.com/courses/ud836/lessons/4038208680/concepts/42807051900923" rel="nofollow noreferrer">this</a> Udacity course.</p>