Android Studio - All file names in project are red but there are no errors

84,964

Solution 1

Perhaps you are seeing the File Status colors that Android Studio uses to show the status of the file. Open Settings and go to Editor > Colors & Fonts > File Status. Here you can see what all of the different colors mean. My guess is that your reddish files are that color because you have not yet added them to source control.

Solution 2

I had the same problem: everything was in red and my MainActivity was not found. I resolved it doing:

File -> Invalidate Caches / Restart

Solution 3

Just simply right clicked the file -> GIT -> Add.

Solution 4

It can be because of you version control system. May be you haven't committed your change on the files committing your change will restore the file names' color to white or go to File->Settings->Version Control and disable the VCS

Solution 5

If anyone happens to import a project and then all files and folder names are brown, that means files/folders are unknown. This happens if imported project has VCS control, to solve this you just have to check in your project root folder for .idea folder and inside it if there's an XML file called vcs.xml: if so, just rename it or delete it, then close and reopen project, all names will become black.

Share:
84,964
tritop
Author by

tritop

Updated on July 08, 2022

Comments

  • tritop
    tritop almost 2 years

    I imported a ADT Project in Android Studio. I got a ton of errors, but I could fix them all. I don't think the "how" is important in this case, I wouldn't be able to recall all the errors anyways. The project runs now without errors, but somehow Android Studio marks all files red. Just the filenames, there are no errors in the code. I tried cleaning and restarting.

    enter image description here

    Did someone experience something like this before? Or maybe a related problem with IntelliJ someone could solve?

    Edit:
    It was the version control. The project was unversioned but in a SVN controlled folder. Thats what the red was indicating. A solution could be to copy the project to a different folder or to add the files to version control.

  • Brandon
    Brandon almost 9 years
    This was great, thank you. I just wanted to add that the brownish-red-orange color for "Unknown" (in my case) referred to a file that was not added to the GIT repository yet. I simply right clicked the file -> GIT -> Add. That turned it green and all was good.
  • herrbischoff
    herrbischoff almost 7 years
    This was posted as an answer, but it does not attempt to answer the question. It should possibly be an edit, a comment, another question, or deleted altogether.
  • Mark A. Donohoe
    Mark A. Donohoe almost 7 years
    Looks like an answer to me. He's saying to add them via git and the files will no longer be red, which is a correct statement and what the OP was asking about. I had the same issue, which is why I'm here, and this did fix it.
  • Gabe Clark
    Gabe Clark almost 7 years
    Glad that fixed it.
  • jungledev
    jungledev over 5 years
    Siva Prakash's answer below is now the correct answer as of 10/2018, because the settings tree has changed.
  • Thern
    Thern over 4 years
    By this, you removed the stored information of the git version control on your computer. Now git does not recognize that the file has been changed, because that information is lost. I doubt that this is what the OP would want.