Error "Activity Class Does Not Exist" When Launching Android App with Adb Shell Am Start

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:

  1. Cleaned the Project
  2. Deleted the Build directory
  3. Restarted Android Studio
  4. Rebuild the Project
  5. Run
  6. 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.

Disable Instant Run in Android Studio 2.1+

Anyway that fixed it for me. Originally pointed out by user @yusufonder. I discovered this was the issue since gradle install still worked.

error activity class does not exist when launching android app with adb shell am start

Managed to figure it out - I left a prompt open with adb logcat, then launched my app on the device - out of this corresponding log entry:

I/ActivityManager( 2115): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=air.com.client.AppName/.AppEntry} from pid 2453

I put together a new command line:

adb shell start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n air.com.client.AppName/.AppEntry

... which does exactly what I wanted. I'll be honest, I don't understand exactly why it works, but that's good enough for now.

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.

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 {} does not exist

I faced a similar problem after refactoring.

This is what i did to resolve this issue:

  1. Cleaned the Project
  2. Deleted the Build directory
  3. Restarted Android Studio
  4. Rebuild the Project
  5. Run
  6. 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.

Disable Instant Run in Android Studio 2.1+

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:

  1. Cleaned the Project
  2. Deleted the Build directory
  3. Restarted Android Studio
  4. Rebuild the Project
  5. Run
  6. 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.

Disable Instant Run in Android Studio 2.1+

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: Activity Class {...} does not exist

In build.gradle, the line:

 apply plugin: 'android-library'

needs changed to:

 apply plugin: 'com.android.application'

Error: Activity class {} does not exist (only on specific phone)

Ok, so after a long research I found out it had something to do with the adb not working properly on my phone. I don't really know why... But for more information check this answer: https://stackoverflow.com/a/32103016/5297218

For me personally re-installing another (older) ROM version was the only thing that fixed my issue.



Related Topics



Leave a reply



Submit