The problem is caused by missing .iml
project files. These files are added automatically to the .gitignore
file but they should not. To fix it:
- Delete
.idea
folder. - Create a new temporary Flutter project with the same name.
- Copy from the project to your existing project these 2 missing files:
[project_name].iml
android/[project_name]_android.iml
- Open Android Studio and the problem should be gone.
To avoid it in the future, make sure .iml files are not excluded in the gitignore. There is a Github issue on this topic.