title: Eclipse - Android App Crashes on Startup?
body: <p>I am currently developing for android using eclipse I recently ran into an issue where my app no longer launches, and it just crashes when it is opened.</p>
  
  <p>I think that the issue may lay in the layout file, or the <code>activity_main</code> file.</p>
  
  <p><br>
  MainActivity class:</p>
  
  <pre><code>package com.dd.splash;
  
  
  import com.google.android.gms.maps.*;
  import com.google.android.gms.maps.model.*;
  import java.io.IOException;
  import java.util.List;
  import java.util.Locale;
  
  import android.app.Activity;
  import android.app.AlertDialog;
  import android.content.ContentResolver;
  import android.content.Context;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.pm.ActivityInfo;
  import android.location.Address;
  import android.location.Geocoder;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.os.Bundle;
  import android.provider.Settings;
  import android.util.Log;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ProgressBar;
  import android.widget.Toast;
  
  
  public class myMainScreen extends Activity 
  implements OnClickListener {
  
   private LocationManager locationMangaer=null;
   private LocationListener locationListener=null; 
  
   private Button btnGetLocation = null;
   private EditText editLocation = null; 
   private ProgressBar pb =null;
  
   private static final String TAG = "Debug";
   private Boolean flag = false;
  
   @Override
   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
  
  
    //if you want to lock screen for always Portrait mode  
    setRequestedOrientation(ActivityInfo
    .SCREEN_ORIENTATION_PORTRAIT);
  
    pb = (ProgressBar) findViewById(R.id.progressBar1);
    pb.setVisibility(View.INVISIBLE);
  
    //This part
    editLocation = (EditText) findViewById(R.id.editTextLocation); 
  
    btnGetLocation = (Button) findViewById(R.id.btnLocation);
    btnGetLocation.setOnClickListener(this);
  
    locationMangaer = (LocationManager) 
    getSystemService(Context.LOCATION_SERVICE);
  
   }
  
   @Override
   public void onClick(View v) {
    flag = displayGpsStatus();
    if (flag) {
  
     Log.v(TAG, "onClick");  
     //setContentView(R.layout.map);
     editLocation.setText("Please wait while we locate you...");
  
     pb.setVisibility(View.VISIBLE);
     locationListener = new MyLocationListener();
  
     locationMangaer.requestLocationUpdates(LocationManager
     .GPS_PROVIDER, 5000, 10,locationListener);
  
     } else {
     alertbox("Gps Status", "Your GPS is: OFF");
    }
  
   }
  
   /*----Method to Check GPS is enable or disable ----- */
   private Boolean displayGpsStatus() {
    ContentResolver contentResolver = getBaseContext()
    .getContentResolver();
    boolean gpsStatus = Settings.Secure
    .isLocationProviderEnabled(contentResolver, 
    LocationManager.GPS_PROVIDER);
    if (gpsStatus) {
     return true;
  
    } else {
     return false;
    }
   }
  
   /*----------Method to create an AlertBox ------------- */
   protected void alertbox(String title, String mymessage) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage("Your Device's GPS is Disabled!")
    .setCancelable(false)
    .setTitle("** Gps Status **")
    .setPositiveButton("Gps On",
     new DialogInterface.OnClickListener() {
     public void onClick(DialogInterface dialog, int id) {
     // finish the current activity
     // AlertBoxAdvance.this.finish();
     Intent myIntent = new Intent(
     Settings.ACTION_SECURITY_SETTINGS);
     startActivity(myIntent);
        dialog.cancel();
     }
     })
     .setNegativeButton("Cancel",
     new DialogInterface.OnClickListener() {
     public void onClick(DialogInterface dialog, int id) {
      // cancel the dialog box
      dialog.cancel();
      }
     });
    AlertDialog alert = builder.create();
    alert.show();
   }
  
   /*----------Listener class to get coordinates ------------- */
   private class MyLocationListener implements LocationListener {
          @Override
          public void onLocationChanged(Location loc) {
  
              editLocation.setText("");
              pb.setVisibility(View.INVISIBLE);
              Toast.makeText(getBaseContext(),"Location changed : Lat: " +
     loc.getLatitude()+ " Lng: " + loc.getLongitude(),
     Toast.LENGTH_SHORT).show();
              String longitude = "Longitude: " +loc.getLongitude();  
        Log.v(TAG, longitude);
        String latitude = "Latitude: " +loc.getLatitude();
        Log.v(TAG, latitude);
  
      /*----------to get City-Name from coordinates ------------- */
        String cityName=null;   
        String countryName=null;
        String stateName=null;
        //Bundle extraInfo=null;
        Geocoder gcd = new Geocoder(getBaseContext(), 
     Locale.getDefault());             
        List&lt;Address&gt;  addresses;  
        try {  
        addresses = gcd.getFromLocation(loc.getLatitude(), loc
     .getLongitude(), 1);  
        if (addresses.size() &gt; 0)  
           System.out.println(addresses.get(0).getLocality());  
           cityName=addresses.get(0).getLocality();
           countryName=addresses.get(0).getCountryName();
           stateName=addresses.get(0).getAdminArea();
           //extraInfo=addresses.get(0).getExtras();
  
  
  
          } catch (IOException e) {            
          e.printStackTrace();  
        } 
  
        //String extraInfoHolder = "(Coming in next update! Check our facebook page for updates)";
        String s = longitude+"\n"+latitude +
     "\n\nYou are currently near "+cityName+", "+stateName+" ("+countryName+")";
  
  
             editLocation.setText(s);
  
          // Get a handle to the Map Fragment
             GoogleMap map = ((MapFragment) getFragmentManager()
                     .findFragmentById(R.id.map)).getMap();
  
             LatLng mylocation = new LatLng(-33.867, 151.206);
  
             map.setMyLocationEnabled(true);
             map.moveCamera(CameraUpdateFactory.newLatLngZoom(mylocation, 13));
  
             map.addMarker(new MarkerOptions()
                     .title("You")
                     .snippet("You are here")
                     .position(mylocation)
                     .alpha(0.7f)
                     .flat(true)
                     //.icon(BitmapDescriptorFactory.fromAsset(marker.jpeg))
  
                     );
  
          }
  
  
  
          @Override
          public void onProviderDisabled(String provider) {
              // TODO Auto-generated method stub         
          }
  
          @Override
          public void onProviderEnabled(String provider) {
              // TODO Auto-generated method stub         
          }
  
          @Override
          public void onStatusChanged(String provider, 
    int status, Bundle extras) {
              // TODO Auto-generated method stub         
          }
      }
      }
  </code></pre>
  
  <p>MainActivity.XML layout file:</p>
  
  
  
  <p></p>
  
  <pre><code>&lt;fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:name="com.google.android.gms.maps.MapFragment"/&gt;
  
  
  &lt;TextView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="@string/hello_world" /&gt;
  
  &lt;LinearLayout
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:weightSum="1"&gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="0.20"
          android:gravity="center"
          android:text="@string/locator_title"
          android:textSize="20sp" /&gt;
  
  
   &lt;EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_weight="0.33"
    android:id="@+id/editTextLocation"
    android:editable="false"&gt;
       &lt;requestFocus&gt;&lt;/requestFocus&gt;
   &lt;/EditText&gt;
  
  
  
  
  
  &lt;/LinearLayout&gt;
  &lt;LinearLayout 
  android:id="@+id/layButtonH" 
  android:layout_height="wrap_content"
  android:layout_width="fill_parent"
  android:gravity="center"
  android:layout_weight="0.15"&gt;
  
  &lt;Button android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:text="@string/location_button"
  android:id="@+id/btnLocation"&gt;&lt;/Button&gt;
  &lt;/LinearLayout&gt;
  &lt;LinearLayout android:id="@+id/layloadingH"
   android:layout_height="wrap_content"
   android:layout_weight="0.20"
   android:layout_width="fill_parent"
   android:gravity="center"&gt;
   &lt;br/&gt;
   &lt;br/&gt;
   &lt;ProgressBar 
   android:layout_width="wrap_content"
   android:id="@+id/progressBar1"
   android:layout_height="wrap_content" &gt;
   &lt;/ProgressBar&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Error Logs:
  <br/></p>
  
  <pre><code>12-07 22:39:20.991: D/AndroidRuntime(29272): Shutting down VM
  12-07 22:39:20.991: W/dalvikvm(29272): threadid=1: thread exiting with uncaught exception (group=0x4157ab90)
  12-07 22:39:21.001: E/AndroidRuntime(29272): FATAL EXCEPTION: main
  12-07 22:39:21.001: E/AndroidRuntime(29272): Process: com.dd.splash, PID: 29272
  12-07 22:39:21.001: E/AndroidRuntime(29272): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dd.splash/com.dd.splash.myMainScreen}: android.view.InflateException: Binary XML file line #72: Error inflating class br
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.ActivityThread.access$700(ActivityThread.java:135)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.os.Handler.dispatchMessage(Handler.java:102)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.os.Looper.loop(Looper.java:137)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.ActivityThread.main(ActivityThread.java:4998)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at java.lang.reflect.Method.invokeNative(Native Method)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at java.lang.reflect.Method.invoke(Method.java:515)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at dalvik.system.NativeStart.main(Native Method)
  12-07 22:39:21.001: E/AndroidRuntime(29272): Caused by: android.view.InflateException: Binary XML file line #72: Error inflating class br
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.Activity.setContentView(Activity.java:1928)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at com.dd.splash.myMainScreen.onCreate(myMainScreen.java:49)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.Activity.performCreate(Activity.java:5243)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2140)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    ... 11 more
  12-07 22:39:21.001: E/AndroidRuntime(29272): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.br" on path: DexPathList[[zip file "/data/app/com.dd.splash-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.dd.splash-1, /vendor/lib, /system/lib]]
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.createView(LayoutInflater.java:559)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
  12-07 22:39:21.001: E/AndroidRuntime(29272):    ... 22 more
  </code></pre>
  
  <p><br/>
  Thanks so much for your help, I have searched for quite a few days now, and cannot track down the issue.</p>