Error type 3 Error: Activity class {} does not exist
I faced a similar problem after refactoring.
This is what i did to resolve this issue:
- Cleaned the Project
- Deleted the
Build
directory - Restarted Android Studio
- Rebuild the Project
- Run
- Optionally (Go to the files menu on android, click on "Invalidate Caches / Restart..." uninstall the app on your phone and try again)
And everything worked fine!
I think the key is to restart your IDE.
Edit 1:
If the above steps don't work for you, then deleting Gradle cache seems to be a solution, as pointed out by @Yasitha.
Edit 2
As suggested by a couple of users in the comments below, sometimes the issue can be resolved by completely removing and reinstalling the app from your device.
Simply type adb uninstall <package>
in terminal to completely remove app from the device.
Edit 3
As mentioned in Abhishek's Answer, one should also try deleting the app from your device in case multiple users are set up on your device.
Simply go to Mobile Settings > Apps > [Your App] > More > Uninstall App for All Users
Edit 4
As mentioned by Yassin Ajdi, executing the uninstallAll
Gradle task can also fix the issue.
You can go to Gradle > Tasks > Install > uninstallAll
to get the job done.
UPDATE for Android Studio 2.1 and up
When running Android Studio 2.1 and up you can also encounter this issue when you have the instant run option enabled in your preferences (is enabled by default).
To disable this option go to the Preferences
option in the Android Studio
top menu and look for Instant Run
so you can uncheck the first checkbox on that screen.
Anyway that fixed it for me. Originally pointed out by user @yusufonder. I discovered this was the issue since gradle install still worked.
Error type 3 Error: Activity class {} does not exist
I faced a similar problem after refactoring.
This is what i did to resolve this issue:
- Cleaned the Project
- Deleted the
Build
directory - Restarted Android Studio
- Rebuild the Project
- Run
- Optionally (Go to the files menu on android, click on "Invalidate Caches / Restart..." uninstall the app on your phone and try again)
And everything worked fine!
I think the key is to restart your IDE.
Edit 1:
If the above steps don't work for you, then deleting Gradle cache seems to be a solution, as pointed out by @Yasitha.
Edit 2
As suggested by a couple of users in the comments below, sometimes the issue can be resolved by completely removing and reinstalling the app from your device.
Simply type adb uninstall <package>
in terminal to completely remove app from the device.
Edit 3
As mentioned in Abhishek's Answer, one should also try deleting the app from your device in case multiple users are set up on your device.
Simply go to Mobile Settings > Apps > [Your App] > More > Uninstall App for All Users
Edit 4
As mentioned by Yassin Ajdi, executing the uninstallAll
Gradle task can also fix the issue.
You can go to Gradle > Tasks > Install > uninstallAll
to get the job done.
UPDATE for Android Studio 2.1 and up
When running Android Studio 2.1 and up you can also encounter this issue when you have the instant run option enabled in your preferences (is enabled by default).
To disable this option go to the Preferences
option in the Android Studio
top menu and look for Instant Run
so you can uncheck the first checkbox on that screen.
Anyway that fixed it for me. Originally pointed out by user @yusufonder. I discovered this was the issue since gradle install still worked.
Error type 3 Error: Activity class {} does not exist
I faced a similar problem after refactoring.
This is what i did to resolve this issue:
- Cleaned the Project
- Deleted the
Build
directory - Restarted Android Studio
- Rebuild the Project
- Run
- Optionally (Go to the files menu on android, click on "Invalidate Caches / Restart..." uninstall the app on your phone and try again)
And everything worked fine!
I think the key is to restart your IDE.
Edit 1:
If the above steps don't work for you, then deleting Gradle cache seems to be a solution, as pointed out by @Yasitha.
Edit 2
As suggested by a couple of users in the comments below, sometimes the issue can be resolved by completely removing and reinstalling the app from your device.
Simply type adb uninstall <package>
in terminal to completely remove app from the device.
Edit 3
As mentioned in Abhishek's Answer, one should also try deleting the app from your device in case multiple users are set up on your device.
Simply go to Mobile Settings > Apps > [Your App] > More > Uninstall App for All Users
Edit 4
As mentioned by Yassin Ajdi, executing the uninstallAll
Gradle task can also fix the issue.
You can go to Gradle > Tasks > Install > uninstallAll
to get the job done.
UPDATE for Android Studio 2.1 and up
When running Android Studio 2.1 and up you can also encounter this issue when you have the instant run option enabled in your preferences (is enabled by default).
To disable this option go to the Preferences
option in the Android Studio
top menu and look for Instant Run
so you can uncheck the first checkbox on that screen.
Anyway that fixed it for me. Originally pointed out by user @yusufonder. I discovered this was the issue since gradle install still worked.
Activity class does not exist (Error type 3)
On some devices (LG Stylus 3 Android 7.0) when you press and move app from desktop to trash can the app does not removed from device. You can restore app trashed by this way later without reinstalling it from Google Play. If it is your case you may see this error:
Error while executing: am start -n "ru.alanov.cashbox/ru.alanov.cashbox.activity.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.your.app/.activity.MainActivity }
Error type 3
Error: Activity class {ru.alanov.cashbox/com.your.app.activity.MainActivity} does not exist.
Error while Launching activity
when trying to reinstall app from Android Studio thru ADB. Go to Settings -> Applications -> Click on your app and delete it. After it error disappears.
Error type 3 - Error: Activity class MainActivity does not exist
It happened after I uninstalled the app directly from android device.
To solve it, I ran:
adb devices
-- to get the connected devices list
followed by:
adb -s device android id uninstall package.name
Then, I ran again in android device with success
Edit:
to clarify the bold texts:
device android id is one of id you'll get after type adb devices.
Typing it, you'll get a list of connected devices with the ids
package.name is the text on top of your kotlin/java files, after the "package", like com.yourname.appname
Error type 3 - Activity class does not exist
I discover that there was something wrong with the android studio, I haven't found the root cause of the problem yet, but the problem was fixed by uninstalling the android studio and install it from another source.
Related Topics
Getcolor(Int Id) Deprecated on Android 6.0 Marshmallow (API 23)
Difference Between Fragmentpageradapter and Fragmentstatepageradapter
How to Change Colors of a Drawable in Android
How to Make Wrap_Content Work on a Recyclerview
How to Include *.So Library in Android Studio
How to Make Ellipsize="Marquee" Always Scroll
Android: How to Bind Spinner to Custom Object List
More Than One File Was Found with Os Independent Path 'Meta-Inf/License'
How to Make Bitmap Compress Without Change the Bitmap Size
How to Record a Video in My Android App
How to Dynamically Update a Listview on Android
How to Customize a Progress Bar in Android
Android Push Notifications: Icon Not Displaying in Notification, White Square Shown Instead
Soft Keyboard Open and Close Listener in an Activity in Android
Android Material and Appcompat Manifest Merger Failed