After cloning a git repository with GitKraken (https://github.com/cloudwebrtc/flutter-webrtc) and opening it in Intellij it marks every file as "Non-Project Files" (Brown background).

enter image description here

Everything builds and runs as intended but it is kinda annoying.

I tried git checkout using IntelliJ instead, but it didn't help.

How can i fix this?


Solution 1: Andrew

File -> Project Structure (Or press Ctrl+Alt+Shift+S)

Project Settings -> Modules

Select your project, and on the right you should have a list of content roots. roots

By default, it will be set as

  • Source Folders:
    • src\main\java
  • Test Source Folders:
    • src\test\java
  • Test Resources Folders:
    • src\test\Resources
  • Excluded Folders:
    • target

If that doesn't clear it up, you may need to adjust where IntelliJ thinks the project directory is in the settings.


Solution 2: Peter

Intellij does not find any source, test or resource folders, because the project you open is not a gradle or maven project. Nor does it have a src folder at the root as.

Solution: Open Gradle tool window and click on the plus button at the top :

The screenshot shows one of mine gradle project: enter image description here

Select the flutter-webrtc/android/build.gradle file to import the android project as a module.

As an alternative, open the android project directly via Files > Open.

HTH


Solution 3: Ryker

Extremely late answer but I just ran into this for my project and realized that the name of my project had dashes like yours which is an invalid module name for IntelliJ. So I just changed the project folder name which solved my issue.


Solution 4: Joel Broström

Remove the .idea folder in the project root and restart android studio to regenerate it.

Make sure to save a copy somewhere since this will remove your workspace.xml file with all your local project configurations such as code run configurations, custom scoops etc.
Replace workspace with the old file and add all missing files from the old to the new folder.

Edit: It might be enough to just remove .idea/vsc.xml and restart Android Studio.


Solution 5: AbdullahA

In Webstorm

Go to File -> Repair IDE

Then in the notification that appears at the bottom right click "Rescan Project Indexes"


Solution 6: Danish Mehmood

the same thing happened to me when I was working with webstorm and pushing changes to github. I a came to know that .idea folder is pushed too, I was noob at that time, I manually deleted the .idea folder by opening gihub remote repo. And then when I locally did git add files and git commit -m "message", it refused to push. I was shocked what the h**** is this, I, then restarted webstorm, and wallah, everything was back.

so the solution to your problem is restart your IDE IntelliJ as I did Webstorm