Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to .gitignore app/app.iml in Android Studio project?

No matter how I structure my .gitignore I can't seem to ignore app/app.iml via Android Studio 2.0.0.

So far, I've tried ignoring all *.iml files per the github's standard Android Studio .gitignore template, as well as targeting the file directly..

app/app.iml
*.iml

Anybody run into a similar issue with this specific file or other *.iml files? How did you resolve it?

like image 518
Nick Sarafa Avatar asked Apr 15 '16 21:04

Nick Sarafa


4 Answers

Try these steps:

  1. Remove cached iml files, use: git rm --cached <all_your_iml_files>
  2. Add *.iml in .gitignore file and commit again.

The iml files will not be tracked after this.

like image 76
Pradeep Kumar HK Avatar answered Nov 01 '22 08:11

Pradeep Kumar HK


Try adding a forward slash to app/app.iml inside your .gitignore like so.. /app/app.iml. This worked for me after following @xiaoyaoworm' advice.

like image 35
Nick Sarafa Avatar answered Nov 01 '22 09:11

Nick Sarafa


If the files were already committed before the gitignore update, it would continue to be tracked by git.

Try doing a git rm --cached app/app.iml and follow that with another commit removing the file.

like image 45
kurtacious Avatar answered Nov 01 '22 08:11

kurtacious


I think what you have done should work. Give a try on installing .ignore plugin, right click on that file app.iml, there is a "Add to ignore file".

like image 27
xiaoyaoworm Avatar answered Nov 01 '22 09:11

xiaoyaoworm