Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AndroidStudio : Cannot resolve symbol MainActivity

I got an error "Cannot resolve symbol MainActivity" on this code.

<activity
        android:name=".MainActivity"          //here
        android:label="@string/app_name"
        android:launchMode="singleTask" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/> 

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="MainActivity"
                android:scheme="callback" />
        </intent-filter>
    </activity>

Needless to say , MainActivity inherits Activity and package name is correct too.

Why?

Thank you

Here's an image of the directory structure.

Snapshot of the directory structure

like image 925
Yuya Okada Avatar asked Jul 30 '14 15:07

Yuya Okada


2 Answers

Clean Caches

File -> Invalidate Caches / Restart...
like image 111
Nitya Kumar Avatar answered Oct 06 '22 10:10

Nitya Kumar


It's possible that your 'src' directory isn't set as a source directory?

Your IDE seems to be seeing your com.example.fovoapp as a simple directory structure instead of a package. Also looking at your linked image, the little "J" on the java files tells me that also. When a java file is set as source usually it shows up as a Class "C".

I could be wrong but make sure you set your src directory as source and that should fix the issue.

like image 20
Miguel Avatar answered Oct 06 '22 09:10

Miguel