简体   繁体   English

Android Studio 无法识别 java 文件

[英]Android Studio cann't recognize java file

Why AndroidStudio can't recognize some java files in my project?为什么AndroidStudio无法识别我项目中的一些java文件?

I have a FileInfo.java in folder, and Android Studio can't take it as a java file,but other java file can be recognized normally. I have a FileInfo.java in folder, and Android Studio can't take it as a java file,but other java file can be recognized normally. My Project can build successfully.我的项目可以成功构建。

Other Java class can't index this FileInfo class.其他 Java class 无法索引此 FileInfo class。 Everywhere which use FileInfo are red text.使用 FileInfo 的所有地方都是红色文本。

The issue seems like this.这个问题似乎是这样的。 Android studio cann't recognize java file Android studio 无法识别 java 文件

How to solve this problem?如何解决这个问题呢?

The files in my folder, FileInfo.java is normal java file, not end with txt.我文件夹中的文件 FileInfo.java 是正常的 java 文件,不以 txt 结尾。 see this picture link my folder structure like this看到这张图片链接我的文件夹结构是这样的

Part of file: part of FileInfo.java部分文件:部分 FileInfo.java

My Project can build successfully,all functions are normal.我的项目可以构建成功,所有功能都正常。 So It won't be wrong with my code or class semantics.所以我的代码或 class 语义不会出错。 I have tried to rebuild and clean cache,but it can't work.我试图重建和清理缓存,但它不能工作。

My Android Studio version is我的 Android Studio 版本是

Android Studio Chipmunk | 2021.2.1
Build #AI-212.5712.43.2112.8512546, built on April 29, 2022
Runtime version: 11.0.12+7-b1504.28-7817840 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Windows 10 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 1280M
Cores: 16
Registry: external.system.auto.import.disabled=true, debugger.watches.in.variables=false
Non-Bundled Plugins: com.karateca.jstoolbox (1.10), com.kite.intellij (1.9.4), com.boohee.plugin.translation2 (2.0), PlantUML integration (5.13.0), org.jetbrains.kotlin-js-inspection-pack-plugin (0.0.10), zielu.gittoolbox (212.8.9), SequenceDiagram (2.1.10), cn.wjdghd.unique.plugin.id (0.2.5)

It most likely means that the java file doesn't contain a class named FileInfo.这很可能意味着 java 文件不包含名为 FileInfo 的 class。

Watch if you wrote FileInfo.java the same as the code in the File注意你是否写了 FileInfo.java 与文件中的代码相同

class FileInfo

or try to build it once or close and reopen IntelliJ thats the most likely Problem.或尝试构建一次或关闭并重新打开 IntelliJ,这是最有可能出现的问题。

greetings问候

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM