In a new Android Studio project, when I view Project Structure, there are 2 modules. One is "ProjectName" and the other is "ProjectName-ProjectName". Did I do something wrong when creating the project?
When creating new projects, we always create a top level project with a single module in it. Studio or IntelliJ will show both in the module list but the top one ("testing") doesn't output anyway.
We do this instead of a flat structure in the root project, so that it will allow you later to easily add new modules (like libraries) without having to convert the structure of your project.
what matters is the "testing-testing" module (we'll probably rename this "testing-main" at some point). the other module doesn't do anything. If you look at its build.gradle it's empty, while the other one declares an Android project.
I got a similar set of .iml files as yours, using an older version of Android Studio, but after upgrading to a later version it created yet another .iml, so then there was a top-level project.iml with a module containing module.iml and module-module.iml.
As far as I could tell, the module-module.iml file was useless, and the key information was in module.iml. However, even if I deleted all the iml files, Android Studio would recreate all of them, so I realized it was storing enough information in the [project]/.idea/modules.xml to recreate the iml files from scratch.
So I exited Android Studio, deleted the .idea folder and the .iml files, then relaunched Android Studio and imported the project using the build.gradle files. It recreated only project.iml and module.iml, and everyone is happy.
SUMMARY: As long as your gradle.build files are clean, then you can delete the .idea and .iml files, import the project using the gradle files, and get a nice clean project structure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With