The application has stopped unexpectedly please try again android
<p>Every time i try launch my app it shows this error:</p>

<pre><code>The application SMSbackupv1 (process com.SMS.Backup) has stpped unexpectedly. please try again.
</code></pre>

<p>i have no idea where the error is been created. however when i debug the file the threadGroup.class shows and it displays</p>

<pre><code>Source not found
the JAR file C:\Program Files (x86)\Android\android-sdk\platforms\android-8\android.jar has no source attachment.
</code></pre>

<p>here is the code:</p>

<pre><code>import java.util.ArrayList;
import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class SMSbackup extends Activity {
    private Button backupBTN;
    public ArrayList&lt;String&gt; exportBuffer = new ArrayList&lt;String&gt;();

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        try {
            backupBTN = (Button) this.findViewById(R.id.button1);

        } catch (Exception e) {
            this.backupBTN.setOnClickListener(new OnClickListener() {
                public void onClick(View v) {
                    try {

                        Cursor c = getContentResolver().query(
                                Uri.parse("content://sms"), null, null, null,
                                null);
                        getColumnData(c);

                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            });

        }
    }

    public void getColumnData(Cursor cur) {
        try {
            if (cur.moveToFirst()) {
                String id;
                String date;
                String phoneNumber;
                String body;

                int idColumn = cur.getColumnIndex("_id");
                int dateColumn = cur.getColumnIndex("date");
                int numberColumn = cur.getColumnIndex("address");
                int bodyColumn = cur.getColumnIndex("body");

                do {

                    id = cur.getString(idColumn);
                    date = cur.getString(dateColumn);
                    body = cur.getString(bodyColumn);
                    phoneNumber = cur.getString(numberColumn);

                    exportBuffer.add(id + " ," + date + " ," + body + " ,"
                            + phoneNumber);

                } while (cur.moveToNext());
            }
            WriteToFile();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private void WriteToFile() {
        try {
            CSV export = new CSV();
            export.generateCSVFile(exportBuffer);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
</code></pre>

<p>Create CSV Class:</p>

<pre><code>import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;

import android.os.Environment;
import android.widget.Toast;

public class CSV extends SMSbackup {

    public static ArrayList&lt;String&gt; data = new ArrayList&lt;String&gt;();
    public static File rootFolder;
    public static File root;
    private static String subFolderName;
    private static String fileName;
    public boolean mExternalStorageAvailable = false;
    public boolean mExternalStorageWriteable = false;

    public CSV() 
    {
        checkStorage();

        if(mExternalStorageAvailable == true &amp;&amp; mExternalStorageWriteable == true)
        {
            root = new File(Environment.getExternalStorageDirectory() + "/SMSMonitor/", null);
            subFolderName = GetSubFolder();
            fileName = getFileName();
        }
    }

    public void checkStorage()
    {
        CharSequence text;
        int duration = Toast.LENGTH_SHORT;
        mExternalStorageAvailable = false;
        mExternalStorageWriteable = false;

        String state = Environment.getExternalStorageState();

        if (Environment.MEDIA_MOUNTED.equals(state)) 
        {
            text = "SD card is Read and Write";
            mExternalStorageAvailable = mExternalStorageWriteable = true;

        } 
        else if (Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) 
        {
            text = "SD Card is Read Only";
            mExternalStorageAvailable = true;
            mExternalStorageWriteable = false;
        } 
        else 
        {
            mExternalStorageAvailable = mExternalStorageWriteable = false;
            text = "Something else is wrong...";
        }
        //Toast toast = Toast.makeText(SmsBackupActivity.defaultInstance, text, duration);
        //toast.show();
    }

    public void generateCSVFile(ArrayList&lt;String&gt; list)
    {
        root = new File(rootFolder + "/SMSMonitor/" + subFolderName, fileName);

        try 
        {
            FileWriter write = new FileWriter(root);

            write.append("ID, Date, Address, Body");
            write.append('\n');

            for (String s : list)
            {
                write.append(s);
                write.append('\n');
            }
            write.flush();
            write.close();
        }
        catch (IOException e) 
        {
            e.printStackTrace();
        }
    }


    private static String getFileName()
    {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        String fileName = "Backup_" + sdf.format(cal.getTime()).toString() + ".csv";

        return fileName;
    }

    private static String GetSubFolder()
    {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        subFolderName = sdf.format(cal.getTime()).toString();

        return subFolderName;
    }

}
</code></pre>

<p>Possible Stack trace?:</p>

<pre><code>    // Compiled from ThreadGroup.java (version 1.5 : 49.0, super bit)
public class java.lang.ThreadGroup implements java.lang.Thread$UncaughtExceptionHandler {

  // Method descriptor #9 (Ljava/lang/String;)V
  // Stack: 3, Locals: 2
  public ThreadGroup(java.lang.String name);
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  new java.lang.RuntimeException [2]
     7  dup
     8  ldc &lt;String "Stub!"&gt; [3]
    10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
    13  athrow
      Line numbers:
        [pc: 0, line: 5]
      Local variable table:
        [pc: 0, pc: 14] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 14] local: name index: 1 type: java.lang.String

  // Method descriptor #17 (Ljava/lang/ThreadGroup;Ljava/lang/String;)V
  // Stack: 3, Locals: 3
  public ThreadGroup(java.lang.ThreadGroup parent, java.lang.String name);
     0  aload_0 [this]
     1  invokespecial java.lang.Object() [1]
     4  new java.lang.RuntimeException [2]
     7  dup
     8  ldc &lt;String "Stub!"&gt; [3]
    10  invokespecial java.lang.RuntimeException(java.lang.String) [4]
    13  athrow
      Line numbers:
        [pc: 0, line: 6]
      Local variable table:
        [pc: 0, pc: 14] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 14] local: parent index: 1 type: java.lang.ThreadGroup
        [pc: 0, pc: 14] local: name index: 2 type: java.lang.String

  // Method descriptor #20 ()I
  // Stack: 3, Locals: 1
  public int activeCount();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 7]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #20 ()I
  // Stack: 3, Locals: 1
  public int activeGroupCount();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 8]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #23 (Z)Z
  // Stack: 3, Locals: 2
  public boolean allowThreadSuspension(boolean b);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 9]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: b index: 1 type: boolean

  // Method descriptor #27 ()V
  // Stack: 3, Locals: 1
  public final void checkAccess();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 10]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #27 ()V
  // Stack: 3, Locals: 1
  public final void destroy();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 11]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #30 ([Ljava/lang/Thread;)I
  // Stack: 3, Locals: 2
  public int enumerate(java.lang.Thread[] threads);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 12]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: threads index: 1 type: java.lang.Thread[]

  // Method descriptor #33 ([Ljava/lang/Thread;Z)I
  // Stack: 3, Locals: 3
  public int enumerate(java.lang.Thread[] threads, boolean recurse);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 13]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: threads index: 1 type: java.lang.Thread[]
        [pc: 0, pc: 10] local: recurse index: 2 type: boolean

  // Method descriptor #35 ([Ljava/lang/ThreadGroup;)I
  // Stack: 3, Locals: 2
  public int enumerate(java.lang.ThreadGroup[] groups);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 14]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: groups index: 1 type: java.lang.ThreadGroup[]

  // Method descriptor #38 ([Ljava/lang/ThreadGroup;Z)I
  // Stack: 3, Locals: 3
  public int enumerate(java.lang.ThreadGroup[] groups, boolean recurse);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 15]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: groups index: 1 type: java.lang.ThreadGroup[]
        [pc: 0, pc: 10] local: recurse index: 2 type: boolean

  // Method descriptor #20 ()I
  // Stack: 3, Locals: 1
  public final int getMaxPriority();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 16]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #41 ()Ljava/lang/String;
  // Stack: 3, Locals: 1
  public final java.lang.String getName();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 17]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #43 ()Ljava/lang/ThreadGroup;
  // Stack: 3, Locals: 1
  public final java.lang.ThreadGroup getParent();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 18]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #27 ()V
  // Stack: 3, Locals: 1
  public final void interrupt();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 19]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #46 ()Z
  // Stack: 3, Locals: 1
  public final boolean isDaemon();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 20]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #46 ()Z
  // Stack: 3, Locals: 1
  public synchronized boolean isDestroyed();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 21]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #27 ()V
  // Stack: 3, Locals: 1
  public void list();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 22]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #50 (Ljava/lang/ThreadGroup;)Z
  // Stack: 3, Locals: 2
  public final boolean parentOf(java.lang.ThreadGroup g);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 23]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: g index: 1 type: java.lang.ThreadGroup

  // Method descriptor #27 ()V
  // Stack: 3, Locals: 1
  public final void resume();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 24]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #54 (Z)V
  // Stack: 3, Locals: 2
  public final void setDaemon(boolean isDaemon);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 25]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: isDaemon index: 1 type: boolean

  // Method descriptor #56 (I)V
  // Stack: 3, Locals: 2
  public final void setMaxPriority(int newMax);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 26]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: newMax index: 1 type: int

  // Method descriptor #27 ()V
  // Stack: 3, Locals: 1
  public final void stop();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 27]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #27 ()V
  // Stack: 3, Locals: 1
  public final void suspend();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 28]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #41 ()Ljava/lang/String;
  // Stack: 3, Locals: 1
  public java.lang.String toString();
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 29]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup

  // Method descriptor #63 (Ljava/lang/Thread;Ljava/lang/Throwable;)V
  // Stack: 3, Locals: 3
  public void uncaughtException(java.lang.Thread t, java.lang.Throwable e);
     0  new java.lang.RuntimeException [2]
     3  dup
     4  ldc &lt;String "Stub!"&gt; [3]
     6  invokespecial java.lang.RuntimeException(java.lang.String) [4]
     9  athrow
      Line numbers:
        [pc: 0, line: 30]
      Local variable table:
        [pc: 0, pc: 10] local: this index: 0 type: java.lang.ThreadGroup
        [pc: 0, pc: 10] local: t index: 1 type: java.lang.Thread
        [pc: 0, pc: 10] local: e index: 2 type: java.lang.Throwable

  Inner classes:
    [inner class info: #7 java/lang/Thread$UncaughtExceptionHandler, outer class info: #76 java/lang/Thread
     inner name: #78 UncaughtExceptionHandler, accessflags: 1545 public abstract static]
}
</code></pre>

<p>Console:</p>

<pre><code>    [2011-07-04 17:59:32 - SMSbackupv1] Android Launch!
[2011-07-04 17:59:32 - SMSbackupv1] adb is running normally.
[2011-07-04 17:59:32 - SMSbackupv1] Performing com.SMS.Backup.SMSbackupv1Activity activity launch
[2011-07-04 17:59:32 - SMSbackupv1] Automatic Target Mode: using existing emulator 'emulator-5554' running compatible AVD 'Test'
[2011-07-04 17:59:32 - SMSbackupv1] Uploading SMSbackupv1.apk onto device 'emulator-5554'
[2011-07-04 17:59:33 - SMSbackupv1] Installing SMSbackupv1.apk...
[2011-07-04 17:59:37 - SMSbackupv1] Success!
[2011-07-04 17:59:37 - SMSbackupv1] Starting activity com.SMS.Backup.SMSbackupv1Activity on device emulator-5554
[2011-07-04 17:59:41 - SMSbackupv1] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.SMS.Backup/.SMSbackupv1Activity }
[2011-07-04 17:59:42 - SMSbackupv1] Attempting to connect debugger to 'com.SMS.Backup' on port 8621
</code></pre>

<p>DDMS Nothing
Debug window shows:
<img src="http://i.stack.imgur.com/nalPv.png" alt="enter image description here"></p>

<p>the application loads once shows the application stopped unexpectedly error then the debugger shows the window above i can step over it all and it goes on for ever then the error shows again :/</p>

<p>Thank you in advance.</p>
