title: Error type 3 - Error: Activity class MainActivity does not exist
body: <p>I've tried to re-create my project cause of this error, in emulator the error was solved, but it kept on android device. It is saying that my MainActivity does not exist.</p>
  <p>I saw <a href="https://stackoverflow.com/questions/58795063/error-activity-class-mainactivity-does-not-exist">this question</a> and tried all answers, but all failed.</p>
  <pre><code>Error while executing: am start -n &quot;com.example.test/com.example.myapplication.MainActivity&quot; -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
  Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.test/com.example.myapplication.MainActivity }
  Error type 3
  Error: Activity class {com.example.test/com.example.myapplication.MainActivity} does not exist.
  
  Error while Launching activity
  </code></pre>
  <p>Here is my AndroidManifest.xml:</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
  &lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
      package=&quot;com.example.myapplication&quot;&gt;
  
      &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.CAMERA&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_WIFI_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
  
      &lt;application
          android:allowBackup=&quot;true&quot;
          android:icon=&quot;@mipmap/ic_launcher&quot;
          android:label=&quot;@string/app_name&quot;
          android:roundIcon=&quot;@mipmap/ic_launcher_round&quot;
          android:supportsRtl=&quot;true&quot;
          android:theme=&quot;@style/AppTheme&quot;&gt;
          &lt;activity
              android:name=&quot;com.example.myapplication.MainActivity&quot;
              android:label=&quot;@string/app_name&quot;
              android:theme=&quot;@style/AppTheme.NoActionBar&quot;&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name=&quot;android.intent.action.MAIN&quot; /&gt;
  
                  &lt;category android:name=&quot;android.intent.category.LAUNCHER&quot; /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  <p>This is my MainActivity, basically the Navigation Drawer template from android studio:</p>
  <pre><code>package com.example.myapplication
  
  import android.content.Intent
  import android.os.Bundle
  import android.util.Log
  import android.view.Menu
  import com.google.android.material.navigation.NavigationView
  import androidx.navigation.findNavController
  import androidx.navigation.ui.AppBarConfiguration
  import androidx.navigation.ui.navigateUp
  import androidx.navigation.ui.setupActionBarWithNavController
  import androidx.navigation.ui.setupWithNavController
  import androidx.drawerlayout.widget.DrawerLayout
  import androidx.appcompat.app.AppCompatActivity
  import androidx.appcompat.widget.Toolbar
  
  class MainActivity : AppCompatActivity() {
  
      private lateinit var appBarConfiguration: AppBarConfiguration
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
          val toolbar: Toolbar = findViewById(R.id.toolbar)
          setSupportActionBar(toolbar)
  
          val drawerLayout: DrawerLayout = findViewById(R.id.drawer_layout)
          val navView: NavigationView = findViewById(R.id.nav_view)
          val navController = findNavController(R.id.nav_host_fragment)
          appBarConfiguration = AppBarConfiguration(setOf(
              R.id.nav_home), drawerLayout)
          setupActionBarWithNavController(navController, appBarConfiguration)
          navView.setupWithNavController(navController)
      }
  
      override fun onCreateOptionsMenu(menu: Menu): Boolean {
          menuInflater.inflate(R.menu.main, menu)
          return true
      }
  
      override fun onSupportNavigateUp(): Boolean {
          val navController = findNavController(R.id.nav_host_fragment)
          return navController.navigateUp(appBarConfiguration) || super.onSupportNavigateUp()
      }
  
      override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
          super.onActivityResult(requestCode, resultCode, data)
      }
  }
  </code></pre>