title: My Android application has stopped unexpectedly
body: <p>When I try to run my app on an emulator, my app comes up with an error message saying </p>
  
  <blockquote>
    <p>The app has stopped unexpectedly. Please try again."</p>
  </blockquote>
  
  <p>How do I fix this?</p>
  
  <p>Here is my code:</p>
  
  <p>Manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.DOLEnterprises.GTA5Guide"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk android:minSdkVersion="4" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt;
      &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
      &lt;uses-permission android:name="android.permission.READ_PHONE_STATE"/&gt;
  
      &lt;application 
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name" &gt;
  
          &lt;activity 
             android:name= "com.google.ads.AdActivity"
             android:configChanges= "keyboard|keyboardHidden|orientation" 
          &gt;&lt;/activity&gt;
  
          &lt;activity
              android:name=".GTA5GuideActivity"
              android:label="@string/app_name" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>The "Appname"Activity.java:</p>
  
  <pre><code>package com.DOLEnterprises.GTA5Guide;
  
  import android.app.Activity;
  import android.os.Bundle;
  
  public class GTA5GuideActivity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      }
  }
  </code></pre>
  
  <p>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:ads= "http://schemas.android.com/apk/lib/com.google.ads"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
      &lt;ImageView
          android:id="@+id/imageView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="bottom"
          android:scaleType="center"
          android:src="@drawable/gtaapp" /&gt;
  
      &lt;com.google.ads.AdView android:id= "@+id/ad"
          android:layout_width="wrap_content"
          android:layout_height= "wrap_content"
          ads:adUnitId= "soon"
          ads:loadAdOnCreate= "a14f8315a6c11bf"
          ads:adSize="BANNER"
      /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>The Logcat thing:</p>
  
  <pre><code>04-10 08:23:55.424: D/dalvikvm(224): GC freed 510 objects / 46816 bytes in 75ms
  04-10 08:23:55.534: D/AndroidRuntime(224): Shutting down VM
  04-10 08:23:55.534: W/dalvikvm(224): threadid=3: thread exiting with uncaught exception          (group=0x4001b188)
  04-10 08:23:55.534: E/AndroidRuntime(224): Uncaught handler: thread main exiting due to uncaught exception
  04-10 08:23:55.554: E/AndroidRuntime(224): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.DOLEnterprises.GTA5Guide/com.DOLEnterprises.GTA5Guide.GTA5GuideActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class com.google.ads.AdView
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.os.Handler.dispatchMessage(Handler.java:99)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.os.Looper.loop(Looper.java:123)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.app.ActivityThread.main(ActivityThread.java:4363)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at java.lang.reflect.Method.invokeNative(Native Method)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at java.lang.reflect.Method.invoke(Method.java:521)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at dalvik.system.NativeStart.main(Native Method)
  04-10 08:23:55.554: E/AndroidRuntime(224): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class com.google.ads.AdView
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.app.Activity.setContentView(Activity.java:1622)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at com.DOLEnterprises.GTA5Guide.GTA5GuideActivity.onCreate(GTA5GuideActivity.java:11)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
  04-10 08:23:55.554: E/AndroidRuntime(224):  ... 11 more
  04-10 08:23:55.554: E/AndroidRuntime(224): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader@44e8ca48
  04-10 08:23:55.554: E/AndroidRuntime(224):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.view.LayoutInflater.createView(LayoutInflater.java:466)
  04-10 08:23:55.554: E/AndroidRuntime(224):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
  04-10 08:23:55.554: E/AndroidRuntime(224):  ... 20 more
  04-10 08:23:55.584: I/dalvikvm(224): threadid=7: reacting to signal 3
  04-10 08:23:55.584: E/dalvikvm(224): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
  04-10 08:24:22.804: D/dalvikvm(231): GC freed 537 objects / 47832 bytes in 68ms
  04-10 08:24:22.913: D/AndroidRuntime(231): Shutting down VM
  04-10 08:24:22.913: W/dalvikvm(231): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
  04-10 08:24:22.913: E/AndroidRuntime(231): Uncaught handler: thread main exiting due to uncaught exception
  04-10 08:24:22.933: E/AndroidRuntime(231): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.DOLEnterprises.GTA5Guide/com.DOLEnterprises.GTA5Guide.GTA5GuideActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class com.google.ads.AdView
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.os.Handler.dispatchMessage(Handler.java:99)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.os.Looper.loop(Looper.java:123)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.app.ActivityThread.main(ActivityThread.java:4363)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at java.lang.reflect.Method.invokeNative(Native Method)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at java.lang.reflect.Method.invoke(Method.java:521)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at dalvik.system.NativeStart.main(Native Method)
  04-10 08:24:22.933: E/AndroidRuntime(231): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class com.google.ads.AdView
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.app.Activity.setContentView(Activity.java:1622)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at com.DOLEnterprises.GTA5Guide.GTA5GuideActivity.onCreate(GTA5GuideActivity.java:11)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
  04-10 08:24:22.933: E/AndroidRuntime(231):  ... 11 more
  04-10 08:24:22.933: E/AndroidRuntime(231): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader@44e8ca28
  04-10 08:24:22.933: E/AndroidRuntime(231):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.view.LayoutInflater.createView(LayoutInflater.java:466)
  04-10 08:24:22.933: E/AndroidRuntime(231):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
  04-10 08:24:22.933: E/AndroidRuntime(231):  ... 20 more
  04-10 08:24:22.953: I/dalvikvm(231): threadid=7: reacting to signal 3
  04-10 08:24:22.953: E/dalvikvm(231): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
  04-10 08:24:31.884: D/dalvikvm(237): GC freed 564 objects / 48880 bytes in 92ms
  04-10 08:24:31.993: D/AndroidRuntime(237): Shutting down VM
  04-10 08:24:31.993: W/dalvikvm(237): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
  04-10 08:24:32.003: E/AndroidRuntime(237): Uncaught handler: thread main exiting due to uncaught exception
  04-10 08:24:32.023: E/AndroidRuntime(237): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.DOLEnterprises.GTA5Guide/com.DOLEnterprises.GTA5Guide.GTA5GuideActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class com.google.ads.AdView
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.app.ActivityThread.access$2200(ActivityThread.java:119)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.os.Handler.dispatchMessage(Handler.java:99)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.os.Looper.loop(Looper.java:123)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.app.ActivityThread.main(ActivityThread.java:4363)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at java.lang.reflect.Method.invokeNative(Native Method)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at java.lang.reflect.Method.invoke(Method.java:521)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at dalvik.system.NativeStart.main(Native Method)
  04-10 08:24:32.023: E/AndroidRuntime(237): Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class com.google.ads.AdView
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.app.Activity.setContentView(Activity.java:1622)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at com.DOLEnterprises.GTA5Guide.GTA5GuideActivity.onCreate(GTA5GuideActivity.java:11)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
  04-10 08:24:32.023: E/AndroidRuntime(237):  ... 11 more
  04-10 08:24:32.023: E/AndroidRuntime(237): Caused by: java.lang.ClassNotFoundException: com.google.ads.AdView in loader dalvik.system.PathClassLoader@44e8ca28
  04-10 08:24:32.023: E/AndroidRuntime(237):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.view.LayoutInflater.createView(LayoutInflater.java:466)
  04-10 08:24:32.023: E/AndroidRuntime(237):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
  04-10 08:24:32.023: E/AndroidRuntime(237):  ... 20 more
  04-10 08:24:32.043: I/dalvikvm(237): threadid=7: reacting to signal 3
  04-10 08:24:32.043: E/dalvikvm(237): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
  </code></pre>