How do I auto-remove trailing whitespace in Android Studio?

You can also enable it on save via the following preference (Editor -> General -> Other):

enter image description here

And for those wondering,

“Always keep trailing spaces on caret line”

If this option is selected, trailing spaces will not be stripped on the line where the caret is placed on save operation (for example, when you switch to another window).

(bigger image)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)