skip to Main Content

Why AndroidStudio can’t recognize some java files in my project?

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. Everywhere which use FileInfo are red text.

The issue seems like this.
Android studio can’t recognize java file

How to solve this problem?

The files in my folder, FileInfo.java is normal java file, not end with
txt.
see this picture link
my folder structure like this

Part of file:
part of FileInfo.java

My Project can build successfully,all functions are normal. So It won’t be wrong with my code or class semantics.
I have tried to rebuild and clean cache ,but it can’t work.

My Android Studio version is

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)

2

Answers


  1. It most likely means that the java file doesn’t contain a class named FileInfo.

    Login or Signup to reply.
  2. Watch if you wrote FileInfo.java the same as the code in the File

    class FileInfo
    

    or try to build it once or close and reopen IntelliJ thats the most likely Problem.

    greetings

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search