Android Studio项目无法识别某些类 [英] Android Studio project doesn't recognize some classes

查看:135
本文介绍了Android Studio项目无法识别某些类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我的项目搞砸了.我不知道它是怎么变成这样的.使用Android Studio时没有电源故障或发生任何事情.第二天,我打开了我的项目,现在整个情况一团糟.我附上了它们现在的外观图像.

Recently my project got messed up. I don't know how it became like this. There was no power failure or anything happened while using Android Studio. Next day I opened my project and now it's a full mess. I attached the images of how they look now.

无法识别类,因为您可以看到它们具有.java扩展名,当我打开其中的一个时,其显示如下.但是如果我直接从记事本或其他工具打开文件,则这些文件的源代码不会更改.

Classes are not recognized as you can see they have .java extension showing and when I opened one of them it show like below. but if I opened the file directly from notepad or something the source-code of these files are not changed.

我确实删除了项目内的所有 .idea 文件.然后使&重新启动,再次构建项目.但是,没有运气,无论我做什么,都无法解决.我有该项目的旧备份,而没有最近的备份,因此我想修复此问题.

I did delete .idea all .iml files inside the project then invalidate & restart build project again. But no luck, no matter what I did it doesn't get resolved. I have an old backup of this project and not a recent one, so I want to get this fixed .

我尝试打开其他项目,它们工作得很好.问题似乎仅在此项目中.在此问题持续存在之前,Android Studio已更新为最新版本.因此,这也不是Android Studio中的错误.

I tried opening my other projects and they work very well. The problem seems to be only in this project. Android Studio is updated to last version before this problem persisted. So it's not also a bug in Android Studio.

这是我使用Notepad ++打开时Java文件的外观.代码没有消失,不,我也没有在Java文件中编写xml代码:

This is how the Java file looks when I opened with Notepad++. The code didn't disappear, no I also didn't write xml code in my Java file:

推荐答案

我只需要将.java文件中的所有源代码复制回android studio编辑器中,该文件的扩展名为.java.问题解决了

I just had to copy all the source code in .java files back into android studio editor, which the files are with .java extension. Problem solved

这篇关于Android Studio项目无法识别某些类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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