Frank Troy
Frank Troy

Reputation: 1

Android Studio Cannot resolve symbol 'MainActivity in Android Manifest.xml

I am not sure if I caused this error by re-nameing an older working directory to use as a new application, but my application does not launch. Maybe its best just to build new that copy? The problem seemed to have started when I copied in some new java code, but that code seems to run fine.

I get the following error when trying to launch the emulator: Could not identify launch activity: Default Activity not found Error while Launching activity

Now I also notice I have the following error in AndroidManifest.xml. Cannot resolve symbol 'MainActivity in AndroidManifest.xml

I have read other posts that state to Invalidate the Cache are restart, but that does not fix my problem.

Below is my AndroidManifest.xml

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

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

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

</manifest>

Here is the AndroidManifest:

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

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="NetTools"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name="com.example.android.MainActivity"  >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

</manifest>

Upvotes: 0

Views: 3536

Answers (1)

Revaz Shalikashvili
Revaz Shalikashvili

Reputation: 143

You are using relative reference to MainActivity (note . (dot) at the beginning). The reference should be relative to package. So make sure that your MainActivity class is located under package com.example.android.nettools

It must be reachable at location com.example.android.nettools.MainActivity

Upvotes: 1

Related Questions