I faced similar problem but I followed following steps in my case :-
1).inside project under .idea folder open modules.xml. 2).check if there are two entries for same iml file. 3).delete one of duplicate entry and close android studio or build gradle file again.
In my case it worked. Hope it helps