Android Studio - All file names in project are red but there are no errors
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.
tritop
Updated on July 08, 2022Comments
-
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.
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 almost 9 yearsThis 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 almost 7 yearsThis 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 almost 7 yearsLooks 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 almost 7 yearsGlad that fixed it.
-
jungledev over 5 yearsSiva Prakash's answer below is now the correct answer as of 10/2018, because the settings tree has changed.
-
Thern over 4 yearsBy 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.