This is terribly frustrating. I have created new project in Android Studio - Empty Activity template so i get one Activity file with its layout file where is one TextView. When i launch the project i get this error:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{package/package.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "package.MainActivity" on path: DexPathList[[zip file "/data/app/package-2.apk"],nativeLibraryDirectories=[/data/app-lib/package-2, /vendor/lib, /system/lib]]
I tried File -> Invalidate Caches / Restart it didn't help.
It is astounding why some error happens on brand new template project.. I am confused..
I created two new projects, it happens on both of them.
Once it happened to me as well. I just cleaned the project and rebuilt it and everything then went perfect so I suggest you do the same.
Follow below steps:
Hope it helps you.