How can I configure Android studio to add new line at end of file?

Yes, you can configure Android Studio to automatically add a new line at the end of a file.

File | Settings... menu, then Editor under IDE Settings, then check the Ensure line feed at file end on Save option box.

This will only take effect on freshly edited files after the setting has been enabled.


UPDATE

On newer versions of Android Studio, the preference location has changed to

File > Preferences > Editor > General > Ensure line feed at file end on Save


enter image description here

On Android Studio Bumblbee open Preferences -> General -> enable option "Ensure every saved file ends with a line break"


In the latest Android Studio (2.3.3), the setting has moved.

Android Studio -> Preferences -> Editor -> General -> Ensure line feed at file end on Save