title: Android : missing package statement; Activity class does not exist
body: <p>I'm getting the message : missing package statement. This comes up in red:</p>
  
  <p><img src="https://i.stack.imgur.com/CzsUE.png" alt="Example"></p>
  
  <p>It's a simple project which I got here, </p>
  
  <p><a href="https://stackoverflow.com/questions/12400504/selecting-contact-from-autocomplete-textview">selecting contact from autocomplete textview</a></p>
  
  <p>I just renamed my MainActivity.java to ContactWithAuto.java. My project builds ok but when I try run it on my phone I get:</p>
  
  <pre><code>Launching application: com.example.chris.autocompletetextview/ContactWithAuto.
  DEVICE SHELL COMMAND: am start -n "com.example.chris.autocompletetextview/ContactWithAuto" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
  open: Permission denied
  Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.chris.autocompletetextview/ContactWithAuto }
  Error type 3
  Error: Activity class {com.example.chris.autocompletetextview/ContactWithAuto} does not exist.
  </code></pre>
  
  <p>I tried this solution but it didn't work:
  <a href="https://stackoverflow.com/questions/21945502/android-studio-auto-fix">Android studio auto fix</a></p>
  
  <p>Also tried cleaning, building, restarting Android Studio several times. Any ideas?</p>
  
  <p>Here is my code :</p>
  
  <p><strong>ContactWithAuto.java:</strong></p>
  
  <pre><code>import android.app.Activity;
  import android.database.Cursor;
  import android.os.Bundle;
  import android.provider.ContactsContract;
  import android.view.Menu;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AutoCompleteTextView;
  import android.widget.SimpleAdapter;
  
  import com.example.chris.autocompletetextview.R;
  
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.Iterator;
  import java.util.Map;
  
  public class ContactWithAuto extends Activity {
  
      private ArrayList&lt;Map&lt;String, String&gt;&gt; mPeopleList;
      private SimpleAdapter mAdapter;
      private AutoCompleteTextView mTxtPhoneNo;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_contact_with_auto);
          mPeopleList = new ArrayList&lt;Map&lt;String, String&gt;&gt;();
          PopulatePeopleList();
          mTxtPhoneNo = (AutoCompleteTextView) findViewById(R.id.mmWhoNo);
          mAdapter = new SimpleAdapter(this, mPeopleList, R.layout.custcontview,
                  new String[] { "Name", "Phone", "Type" }, new int[] {
                  R.id.ccontName, R.id.ccontNo, R.id.ccontType });
          mTxtPhoneNo.setAdapter(mAdapter);
  
      }
  
      public void PopulatePeopleList() {
          mPeopleList.clear();
          Cursor people = getContentResolver().query(
                  ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
          while (people.moveToNext()) {
              String contactName = people.getString(people
                      .getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
              String contactId = people.getString(people
                      .getColumnIndex(ContactsContract.Contacts._ID));
              String hasPhone = people
                      .getString(people
                              .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER));
  
              if ((Integer.parseInt(hasPhone) &gt; 0)){
                  // You know have the number so now query it like this
                  Cursor phones = getContentResolver().query(
                          ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                          null,
                          ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = "+ contactId,
                          null, null);
                  while (phones.moveToNext()){
                      //store numbers and display a dialog letting the user select which.
                      String phoneNumber = phones.getString(
                              phones.getColumnIndex(
                                      ContactsContract.CommonDataKinds.Phone.NUMBER));
                      String numberType = phones.getString(phones.getColumnIndex(
                              ContactsContract.CommonDataKinds.Phone.TYPE));
                      Map&lt;String, String&gt; NamePhoneType = new HashMap&lt;String, String&gt;();
                      NamePhoneType.put("Name", contactName);
                      NamePhoneType.put("Phone", phoneNumber);
                      if(numberType.equals("0"))
                          NamePhoneType.put("Type", "Work");
                      else
                      if(numberType.equals("1"))
                          NamePhoneType.put("Type", "Home");
                      else if(numberType.equals("2"))
                          NamePhoneType.put("Type",  "Mobile");
                      else
                          NamePhoneType.put("Type", "Other");
                      //Then add this map to the list.
                      mPeopleList.add(NamePhoneType);
                  }
                  phones.close();
              }
          }
          people.close();
          startManagingCursor(people);
      }
  
      public void onItemClick(AdapterView&lt;?&gt; av, View v, int index, long arg){
          Map&lt;String, String&gt; map = (Map&lt;String, String&gt;) av.getItemAtPosition(index);
          Iterator&lt;String&gt; myVeryOwnIterator = map.keySet().iterator();
          while(myVeryOwnIterator.hasNext()) {
              String key=(String)myVeryOwnIterator.next();
              String value=(String)map.get(key);
              mTxtPhoneNo.setText(value);
          }
      }
  
  //    @Override
  //    public boolean onCreateOptionsMenu(Menu menu) {
  //        getMenuInflater().inflate(R.menu.activity_contact_with_auto, menu);
  //        return true;
  //    }
  }
  </code></pre>
  
  <p><strong>manifest:</strong></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.example.chris.autocompletetextview" &gt;
  
      &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="ContactWithAuto"
              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>