This question already has an answer here:
I'm posting a quick reference for "How can I show line numbers in Android Studio?" See answer below.
NOTE: This question has been marked as a duplicate because Android Studio is based on IntelliJ. In future, if you have a similar question, it's probably worth looking for the IntelliJ setting.
In Windows
1.Press Ctrl+Shift+A
2.Input following string: "show line numbers"
And you will see the setting, this method can find all the settings easily!
MAC
1.Press Command+Shift+A
2.Input following string: "show line numbers"
and following same flow of android studio.
It's simple. Just Right click in left side of Workspace area and choose Show line number.


UPDATE The location for this setting has been changed to Editor -> General -> Appearance.