5

How can I fix this error. MainActivity class already in my project. Here's a screenshot of the error enter image description here

I tried this link, but it didn't work for me

Mr. Roshan
  • 1,777
  • 13
  • 33
d_a_n_u_92
  • 51
  • 1
  • 4
  • Is your package tree correctly structured? Are you sure activity class match the one defined on the manifest? – Raymond Arteaga Jun 09 '18 at 04:06
  • @RaymondArteaga yes. check this out. – d_a_n_u_92 Jun 09 '18 at 04:34
  • First, stop or turn off the instant run, then after try with invalidate catch and restart options file menu. – Dhaval Solanki Jun 09 '18 at 04:45
  • Package of your activity class is equal to the package name defined in your manifest concatenated with the android:name of your activity declared in your manifest? – Raymond Arteaga Jun 09 '18 at 05:18
  • make sure that your activity is listed in AndroidManifest.xml file – primo Jun 09 '18 at 11:55
  • check your package and also define main activity into android manifest file. provide hall things what ever you done. –  Jun 19 '18 at 08:47
  • @AndroidTeam this issue can also be produced if a device with multiple accounts has an app installed on it then uninstalled from the home screen. The user must go to `uninstall for all users` in the app menu. – jfa Jan 03 '19 at 05:42

5 Answers5

2

I got this error as well. For me it helped to set minifyEnabled to false for my debug version. After Clean Build it launched again.

Arieck
  • 2,002
  • 2
  • 9
  • 8
2

It may be silly but make sure you have enough storage on your phone. This was the problem for me

Faraz Ahmed
  • 153
  • 11
0

I have faced this problem when I tried to build & run on real device Android 8.1, API 27. Saw this and this answers, but they didn't helped.

Solution: Then, tried to run on emulator Android 7.1 API 25, everything went fine. Hope this will help others.

Jasurbek Nabijonov
  • 1,607
  • 3
  • 24
  • 37
0

This suddenly happened to me today. After trying several other potential solutions, nothing worked. I then looked in the app configuration and noticed that the Installable Options: Deploy method had been set to "APK from app bundle" instead of "Default APK". Setting it back to "Default APK" fixed the issue for me. I hope this helps someone :-)

0

just make sure your emulator is RUNNING, and that you're LOGGED INTO IT.

I haven't the foggiest idea why this error message is returned for "unable to deploy an app while your device is booting or locked," but literally every time I've been hit with this error:

  1. If the device hasn't made it to its home screen, then if I kill the device and relaunch it from the device manager, then run a build, it's resolved, or

  2. If it's sitting on the lock screen, simply unlocking it then rerunning the build resolves matters.

I noticed it start after I set up biometrics on the emulator. I'm reasonably convinced that "Error 3" is "we couldn't manage to get the app onto the device or emulator, and since we dunno why,we'll say we couldn't launch the main activity" (which, to be fair, it COULDN'T).

NerdyDeeds
  • 343
  • 1
  • 11