NuiDev
NuiDev

Reputation: 121

Unresolved class MainActivity - AndroidManifest.xml

I have an Error in my AndroidManifest.xml I don't know why but it's just here...

This is AndroidManifest.xml:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="packagename">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".RegisterActivity"></activity>
        <activity android:name=".MainActivity" />
        <activity android:name=".LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

So basically my Main Activity is pretty empty, and I don't know why this Appears here: C My main activity:

package packagename;

import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

here is the image:
here is the image

Upvotes: 4

Views: 5402

Answers (4)

Azhar Shaikh
Azhar Shaikh

Reputation: 19

i also face this error i tried both invalid catches and rebuild project

.MainActivity error in android manifest Occurred due to namespace error in build.gradle.app Just change the name of your build.gradle.app  lowercase or same as project name android

Upvotes: -1

Farhan Tariq Janjua
Farhan Tariq Janjua

Reputation: 59

Replace this line of code:

<activity android:name="MainActivity"/>

with this:

<activity android:name="com.fayamedia.otakucounter.MainActivity"/>

Upvotes: 0

mac229
mac229

Reputation: 4839

File (Top menu) -> Invalidate caches / restart. It should resolve your problem

Upvotes: 4

K M Rejowan Ahmmed
K M Rejowan Ahmmed

Reputation: 1267

It's just a false error. Sometimes Android Studio goes mad. Just Restart the Android Studio and Open Project Again. It will solve the problem. If not restart your pc.

Upvotes: 4

Related Questions