问题
I have a device nexus5x with android O and i develop an app in my laptop and also in another computer. But when i want to start the app in another computer after i have started it in my laptop i always get error described below.
Error while executing: am start -n "com.safetylink.android.safetylinkheartbeatapp/com.application.aware.safetylink.auth.SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.safetylink.android.safetylinkheartbeatapp/com.application.aware.safetylink.auth.SplashScreenActivity }
Error type 3
Error: Activity class {com.safetylink.android.safetylinkheartbeatapp/com.application.aware.safetylink.auth.SplashScreenActivity} does not exist.
Error while Launching activity
It's a magic for me, because i don't have the same problem with another phones (it's just being reinstalled) and with emulator. Application works fine on them.
I think it's related to nexus5x settings, but i don't know exactly. What should i do, to fix this problem?
P.S.: I have already tryed to clean, rebuild project, rename activity, invalidate cache and restart for several times, also disable instance run, but it doesn't work for me.
回答1:
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.
回答2:
If you are getting this error, it may be because the app that you are trying to load is still installed for another user account on the same device.
In other words, uninstalling an app for the current user account does not necessarily uninstall the same app for all other user accounts on the device.
If you go into Settings => App and look for the device in question, you will see that it may still be there. If that is the case, Tap on the app to show the App Info screen and goto the "..." overflow menu on the upper right hand side. Tap that and there should be an option to uninstall the app for all users.
Once you have uninstalled the app for all users, this error should go away and you should be able to load and run the app.
回答3:
Looks like there are lot of possible issues that causes this error. In my case I had changed the Installation options (see below steps to know where is Installation options) to "APK from app bundle"
Here is how I resolved it. May be helpful for someone.
- In AndroidStudio (AS) under "Run" Toolbar/Menu select "Edit configurations" menu item.
- In the Run/Debug Configuration popup Window, under "Android App" select "app"
- To the rightside, under "General" tab check if Module: app is selected.
- Under "Installation Options", "Deploy: " was selected wrongly. Selected back to"Default APK" and everything worked properly there after.
Installation Option Screen Shot
回答4:
I have the same issue with my project. I resolve it by navigating to file and clicking on Invalidate Caches/Restart.
回答5:
In my case, the installation of the "Deploy: Default APK" option in Android Studio was helpful
回答6:
On the phone having the problem go to: Settings Apps. If you see the app in the list select it and uninstall from there.
Seems as if just drag to uninstall doesn't really uninstall it.
Another great android feature
回答7:
Thanks a lot to above answers, I guess in my case the issue was with Redmi devices running on MIUI which supports Second Space.
I had it enabled which was causing problems with uninstalling previous installation thereby troubling new install, btw I had also tried to manually copy the APK to sdcard install it, which also failed saying "App cant be installed".
So if anyone like me is using MIUI please double check Second space is enabled when you are getting this error and your app is not available in Settings->Apps and Launcher.
来源:https://stackoverflow.com/questions/46888298/activity-class-does-not-exist-error-type-3