I started cloning an Android project from my Git server and while initially opening the project Android Studio gave me an error: "Cannot load module myProject" and asks me to remove it.
After the removal Git then is already showing me a change made to the modules.xml file:
<module fileurl="file://$PROJECT_DIR$/old_project_name.iml" filepath="$PROJECT_DIR$/old_project_name.iml" />
got changed to
<module fileurl="file://$PROJECT_DIR$/new_project_name.iml" filepath="$PROJECT_DIR$/new_project_name.iml" />
That's caused by the different project name (Android Studio / IntelliJ can't find the path listed in modules.xml) and is therefore hard to put under version control where users may have different names for their local clone of the project.
There already is a post about making this project name user-independent, coming to no results.
The IntelliJ IDEA help site states:
The .idea directory contains a set of configuration files (.xml). Each file contains only a portion of configuration data pertaining to a certain functional area which is reflected in the name of a file, for example, compiler.xml, encodings.xml, modules.xml.
Almost all of the files contain information core to the project itself, such as names and locations of its component modules, compiler settings, etc. Thus, these files may (and should) be kept under version control.
Another answer on a question about version control for the .idea/ directory is about configuring Gradle / Maven to substitute the IDEA project files.
How is this done?
Is there a way to achieve a user-independent modules.xml?
EDIT: Adding the file to .gitignore appears to work, the IDE will generate it.