title: Error In Android - Eclipse
body: <p>Recently I started developing android applications, when compiling the application in the emulator the process is terminated.</p>
  
  <p><strong>LogCat:</strong></p>
  
  <pre><code>05-10 17:55:21.539: D/AndroidRuntime(4293): Shutting down VM
  05-10 17:55:21.539: W/dalvikvm(4293): threadid=1: thread exiting with uncaught exception (group=0x40020578)
  05-10 17:55:21.562: E/AndroidRuntime(4293): FATAL EXCEPTION: main
  05-10 17:55:21.562: E/AndroidRuntime(4293): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{br.me.example.clientes/br.me.example.clientes.Principal}: java.lang.ClassNotFoundException: br.me.example.clientes.Principal in loader dalvik.system.PathClassLoader[/data/app/br.me.example.clientes-2.apk]
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.os.Handler.dispatchMessage(Handler.java:99)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.os.Looper.loop(Looper.java:130)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.app.ActivityThread.main(ActivityThread.java:3687)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at java.lang.reflect.Method.invokeNative(Native Method)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at java.lang.reflect.Method.invoke(Method.java:507)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at dalvik.system.NativeStart.main(Native Method)
  05-10 17:55:21.562: E/AndroidRuntime(4293): Caused by: java.lang.ClassNotFoundException: br.me.example.clientes.Principal in loader dalvik.system.PathClassLoader[/data/app/br.me.example.clientes-2.apk]
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
  05-10 17:55:21.562: E/AndroidRuntime(4293):     ... 11 more
  </code></pre>
  
  <p>Class Principal</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>package br.me.clientes;
  
  import br.me.example.clientes.R;
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  
  public class Principal extends Activity {
   @Override
   protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.principal);
  
    Button btnCadastro = (Button) findViewById(R.id.btnCadastro);
    Button btnListar = (Button) findViewById(R.id.btnListar);
    Button btnApagar = (Button) findViewById(R.id.btnApagar);
    Button btnSair = (Button) findViewById(R.id.btnSair);
  
    btnCadastro.setOnClickListener(new View.OnClickListener() {
  
     @Override
     public void onClick(View v) {
      // TODO Auto-generated method stub
      startActivity(new Intent(getBaseContext(), Cadastro.class));
  
     }
    });
  
    btnListar.setOnClickListener(new View.OnClickListener() {
  
     @Override
     public void onClick(View v) {
      // TODO Auto-generated method stub
      startActivity(new Intent(getBaseContext(), Cadastro.class));
  
     }
    });
  
    btnApagar.setOnClickListener(new View.OnClickListener() {
  
     @Override
     public void onClick(View v) {
      // TODO Auto-generated method stub
      startActivity(new Intent(getBaseContext(), Cadastro.class));
  
     }
    });
  
    btnSair.setOnClickListener(new View.OnClickListener() {
  
     @Override
     public void onClick(View v) {
      // TODO Auto-generated method stub
      startActivity(new Intent(getBaseContext(), Cadastro.class));
  
     }
    });
  
   }
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Class Cadastro</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>package br.me.clientes;
  
  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.graphics.Color;
  import android.os.Bundle;
  import android.os.Handler;
  import android.os.Message;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  import br.me.example.clientes.R;
  
  public class Cadastro extends Activity implements Runnable {
  
   private ProgressDialog pd;
   private String valor;
   private EditText txtNome;
   private EditText txtEmail;
  
   @Override
   protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.cadastro);
  
    Button btnOk = (Button) findViewById(R.id.btnOk);
    txtNome = (EditText) findViewById(R.id.txtNome);
    txtEmail = (EditText) findViewById(R.id.txtEmail);
    final EditText txtEndereco = (EditText) findViewById(R.id.txtEndereco);
    final EditText txtNumero = (EditText) findViewById(R.id.txtNumero);
  
    btnOk.setOnClickListener(new View.OnClickListener() {
  
     @Override
     public void onClick(View v) {
      pd = ProgressDialog.show(Cadastro.this, "Aguarde",
        "Cadastrando informações", true, false);
      Thread t = new Thread(Cadastro.this);
      t.start();
  
     }
    });
  
   }
  
   @Override
   public void run() {
    // TODO Auto-generated method stub
    valor = txtNome.getText().toString();
  
    if (txtNome.getText().toString().equals(" ")) {
     h2.sendEmptyMessage(0);
    }
  
   }
  
   private Handler h = new Handler() {
    @Override
    public void handleMessage(Message msg) {
     pd.dismiss();
     Toast t = Toast.makeText(getBaseContext(), txtNome.getText(),
       Toast.LENGTH_SHORT);
     t.show();
  
    }
   };
  
   private Handler h2 = new Handler() {
    @Override
    public void handleMessage(Message msg) {
     pd.dismiss();
     Toast t = Toast.makeText(getBaseContext(), "Preencha o campo Nome",
       Toast.LENGTH_SHORT);
     t.show();
     txtNome.setBackgroundColor(Color.RED);
  
    }
   };
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Android Manifest</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="br.me.example.clientes"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="8"
          android:targetSdkVersion="21" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity 
              android:name=".Principal"&gt;
              &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN"&gt; &lt;/action&gt;
              &lt;category android:name="android.intent.category.LAUNCHER"&gt; &lt;/category&gt;    
          
          &lt;/intent-filter&gt;
          &lt;/activity&gt;
          
          &lt;activity android:name=".Cadastro"&gt;&lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Ready.</p>
  
  <p>If you need something let me know.</p>