背景
Githubからクローンしたプロジェクトをビルドしようとしたところ、Gradle sync failed: Already disposed: Module:
というエラーが発生してモジュールが認識されませんでした。
参考
対応
Quick Solution: In order to make it work the easiest is to delete .idea/modules.xml along with the .iml files. Additionally may worth deleting .idea/modules/ folder if it exists. Restart Android Studio (no need to clear cache) and force a Gradle sync from Gradle view or toolbar to recreate the files.
https://stackoverflow.com/a/50430517 より引用。
上記引用文の通り、.idea/modules.xml
と.iml
を削除し、AndroidStudioを再起動、その後該当プロジェクトを開きなおすと正常に認識されました。