I keep receiving the following error message when trying to run my application on an emulator:
$ adb shell am start -n "com.example.androidmobiledemo/com.example.androidmobiledemo.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Error while executing: am start -n "com.example.androidmobiledemo/com.example.androidmobiledemo.MainActivity" -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.androidmobiledemo/.MainActivity }
Error type 3
Error: Activity class {com.example.androidmobiledemo/com.example.androidmobiledemo.MainActivity} does not exist.
Error while Launching activity
I realize that this a common problem for which solutions have been provided but I've looked at a few and still am not able to debug. I thought it was something specific to my application so I went through the usual debugging steps of invalidating my caches, deleting the build directory, etc but then I created a sample project from a template and it builds fine but when I go to run it on an emulator, I get the same error message. and I'm not sure why. In the past day I had reinstalled Android Studio so I'm wondering if this is some side effect of doing so? In the emulator, I don't see the apps having been installed. What further debugging steps can I take?
Edit: I saw that in the Logcat output, there was an ActivityManager log mentioning that the package name was invalid. Using the answer provided in this question I changed the package name to something else, cleaned, rebuilt and I'm still having the same problem.