Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The activity 'MainActivity' is not declared in AndroidManifest.xml

Tags:

android

xml

I am getting an error which reads The activity 'MainActivity' is not declared in AndroidManifest.xml

Screenshot of the error

What is the problem here?

like image 425
Jodhvir Singh Avatar asked Oct 21 '16 18:10

Jodhvir Singh


People also ask

Where do you declare activity in manifest?

Activities and other application components, such as services, are declared in the AndroidManifest. xml file.

What is MainActivity Java file?

The Main Activity File The main activity code is a Java file MainActivity.java. This is the actual application file which ultimately gets converted to a Dalvik executable and runs your application.

Which tag is used to declare an activity in the manifest file?

Element Tags of Manifest File It consists of a package attribute package that tells the activity's package name. It is the subelement of the manifest file that includes the declaration of the namespace. It contains certain attributes.

How do I rename my MainActivity?

Yes, you can change the name of MainActivity by, opening the directory of the java file in android studio, right-click on it and find refactor, then rename, put in the name you like then click on refactor. Save this answer.


1 Answers

I got this error when moving a lot of files, to fix just resync your gradle files.

File->Sync Project with Gradle Files

like image 66
MRDJR97 Avatar answered Sep 19 '22 20:09

MRDJR97