AndroidStudio:无法解析符号MainActivity [英] AndroidStudio : Cannot resolve symbol MainActivity

查看:6413
本文介绍了AndroidStudio:无法解析符号MainActivity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了一个错误在这个code无法解析符号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>

不用说,MainActivity继承性与封装名称是正确的了。

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

为什么?

感谢您

下面的目录结构的图像。

Here's an image of the directory structure.

推荐答案

这有可能是你的src目录未设置为源目录?

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

您IDE似乎看到你com.example.fovoapp作为一个简单的目录结构,而不是一包。还看你的链接的图像,对java文件的小J告诉我之谓也。当一个java文件设置为源通常它显示为一类C。

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".

我可能是错的,但要确保你设定的src目录源和应该解决这个问题。

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

这篇关于AndroidStudio:无法解析符号MainActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆