There is an option in Android studio to enable EditorConfig support( defaultsettings->codingstyle dialog),but not sure how it works.Could you please let me know how to integrate .editorconfig file in the Andriod Studio project?
Asked
Active
Viewed 9,503 times
1 Answers
36
The website EditorConfig.org has a good explanation of how to get it set up. Android Studio has it built-in so there should be no need to add a plugin or set up Android Studio, just..
- Add your
.editorconfig
file in the root directory of the project (as mentioned at EditorConfig.org) - Enable EditorConfig support (
Settings
→Editor
→Code Style
→Enable EditorConfig support
)
A search for .editorconfig files will stop if the root filepath is reached or an EditorConfig file with root=true is found.
Edit:
I would recommend starting with something along these lines, and tweaking it as your team sees fit:
# indicate this is the root of the project
root = true
[*.{kt,java,xml,gradle,md}]
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf

Community
- 1
- 1

Joshua King
- 3,450
- 1
- 17
- 19
-
1I updated it to give a suggested `.editorconfig` file starting point. – Joshua King Dec 18 '18 at 21:15