92

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.

Zoe
  • 27,060
  • 21
  • 118
  • 148
tritop
  • 1,655
  • 2
  • 18
  • 30

15 Answers15

142

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.

Scott W
  • 9,742
  • 2
  • 38
  • 53
  • 8
    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. – Brandon Jul 22 '15 at 17:01
  • 1
    Siva Prakash's answer below is now the correct answer as of 10/2018, because the settings tree has changed. – jungledev Oct 02 '18 at 11:20
30

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

File -> Invalidate Caches / Restart

Oriol Roma
  • 329
  • 1
  • 5
  • 9
Netero
  • 3,761
  • 2
  • 29
  • 29
18

Just right-click on the file -> GIT -> Add.

Lunox
  • 318
  • 2
  • 7
15

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.

alexscmar
  • 421
  • 5
  • 11
15

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

Teka
  • 151
  • 1
  • 2
12

It is because Version Control(like Git) have been enable in your project.

Go to File -> Settings -> Editor. Under Version Control select File Status Colors. It contains list of different colors and what they mean.

enter image description here

Siva Prakash
  • 4,626
  • 34
  • 26
7

From the screenshot that you have attached, it appears that it is because of VCS enabled.

Case 1: You want to use VCS. And you have not committed the code. If this is the case, then please commit the code.

Case 2: VCS is enabled and you are not aware of that. To disable this, Go to Setting-> Version Control.

In the right panel, you will see a Project and type of VCS. Select that row and click on the VCS item. In the dropdown, select .

This will resolve your issue.

Bhargav Jhaveri
  • 2,123
  • 1
  • 18
  • 23
2

Using SVN repository under Android Studio, I got same issue after renaming the package name. To solve it, you will need to do a right click on the red files/Subversion/Add to CVS -> Then the files will be green, after you have to commit them, they will be normal (black color).

user2167877
  • 1,676
  • 1
  • 14
  • 15
1

This happened to me every time I would set up a git repo in my project. To answer the question, simply add the problematic files to your VCS, "git add" in my case and you should be good to go.

Gabe Clark
  • 23
  • 5
  • 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. – herrbischoff Jul 05 '17 at 16:55
  • 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. – Mark A. Donohoe Jul 22 '17 at 05:54
  • Glad that fixed it. – Gabe Clark Jul 24 '17 at 21:48
1

Solutions for existing project that are newly cloned

  • delete or rename .idea/vcs.xml and restart android studio
  • Check exact folder is added as root in File->Settings->Version Control
  • Check proper vcs tool configured in File->Settings->Version Control and remove unwanted entries
Nidhin
  • 1,818
  • 22
  • 23
1

VCS: commit After that, the red color is gone in my case.

Homan Huang
  • 413
  • 5
  • 8
0

I've had similar problems with IntelliJ and have some more details that may prove helpful:

  • If for some reason IntelliJ imports a project using a VCS other than what is used by your project, it may effect how it looks at project roots. For example, IntelliJ kept importing projects with Subversion as the VCS when we use Git -- Subversion creates a root for every top-level folder and Git just had just a single root (I have no idea why).
  • As suggested above, going into Settings->Version Control (IntelliJ IDEA ->Preferences for OS X) and changing the VCS type to "Git" or "none" would make the red characters go away.
  • I had no idea why IntelliJ kept importing the project as Subversion so I went into the plugins and disabled "Subversion Integration" -- that got rid of the problem for good.
0

I had similar issue, i had git version control installed and it happened after i changed my package name.

I had resolved the same by "git add .".

Hope it helps others.

Shivin
  • 1
  • 1
0

Well the same thing happened to me but I was sure there were no errors, nothing was wrong and the answer to this red is probably because you are using git and android studio tells you that you need to update (git add files), I hope it works for you.

-2

I went to my project folder (c:\users\ ... \AndroidStudioProjects\my project folder\ , and deleted the .git folder. (it's hidden).

The Problem Solved.

  • 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. – Thern Nov 12 '19 at 14:07