Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get number of lines of a project in Android Studio?

Is it possible to get the number of lines written in a project in Android Studio (current version is 2.1.1) ? (without using a plugin would be better)

like image 841
ThomasV Avatar asked May 26 '16 07:05

ThomasV


People also ask

Why does Android studio have lines?

That line historically represents the margin of A4 paper, which is useful only if you need to print the code. Old school says that you should keep your code inside that margin, to guarantee much portability.


2 Answers

One way is to search (ctrl+shift+F) for line breaks \n with regular expressions enabled and whole project as the scope. If you want to limit the search to only java and xml files, you can use the following file mask *.java, *.xml

like image 66
Urho Avatar answered Oct 21 '22 17:10

Urho


As alternative you can use (Linux, Windows) utility cloc (Count Lines Of Code). Cloc counts, and computes differences of, comment lines, blank lines, and physical lines of source code.

An example basic use (my project):

cloc /home/myHome/StudioProjects/myApp/app/src/      111 text files.      111 unique files.        0 files ignored.  github.com/AlDanial/cloc v 1.70  T=0.36 s (308.1 files/s, 38552.3 lines/s) ------------------------------------------------------------------------------- Language                     files          blank        comment           code ------------------------------------------------------------------------------- Java                            50           1323            146           6407 XML                             60            460             50           3203 SQL                              1              0              0           2302 ------------------------------------------------------------------------------- SUM:                           111           1783            196          11912 -------------------------------------------------------------------------------   

Project page https://github.com/AlDanial/cloc (thanks Xam)

like image 28
elpresidento Avatar answered Oct 21 '22 17:10

elpresidento