How many lines of code are in Android 14?
You probably came here because you searched for how much code on your device runs. The rough answer is 66 million for explanations why putting a number on this is misleading read the next section. If you want to explore explore the data yourself there are two more detailed sections below.
To be Android or not to be Android
If you want to be extremely liberal in your definition, you can consider android an ecosystem. That would include everything from the bootloader to developer documentation to store apps to the smartwatch that only works on android. This would be practically impossible to count and easily reach the billions. An extremely conservative approach would look at the bare minimum lines of OS code that need to be compiled to pass the official Compatibility Test Suite. While theoratically feasible and potentially useful the average user probably wouldn’t recognize this as a mobile operating system.
As a middle ground this counting examines the contents of the main AOSP repo. A current checkout of the repo is roughly 168 GiB large this is however on only code but also documnetation, developer tools and other ecosystem components. To break down this code I created aosp-analyzer a set of scripts and a program that produces a handy HTML file (a slightly modified version is used for the interactive statistics at the end of this article). Let’s break it down some more:
It depends on androids repo
tool to obtain the source code and tokei to do the heavy line counting work. During line counting I do a preliminary categorization of line data based on the top level directories. After those first two slow steps it begins its actual analysis work: It seperates test code and documentation from the rest (1), removes data only files (mainly random test data) (2) and assembles the html (3). In case you are curious about the details, I think the code is more explicit than this text could ever be.
Quick facts
- There are over 199 million source code lines contributing to android.
- Roughly 66 million lines of code run on the average device.
- 68 million lines of comments and documentation tell the developers what the code does.
- 8.8% lines are empty.
Details
Code | Comments | Blank | |
---|---|---|---|
Java | 3548821 | 1876125 | 633057 |
Cpp | 3221947 | 485173 | 491753 |
CHeader | 1872257 | 667868 | 297198 |
AssemblyGAS | 654921 | 19977 | 13479 |
CppHeader | 386409 | 19275 | 77673 |
Kotlin | 307669 | 94850 | 47725 |
C | 269806 | 60948 | 43839 |
AsciiDoc | 188417 | 4585 | 34479 |
Python | 94204 | 12163 | 17095 |
Rust | 77782 | 10796 | 10109 |
Protobuf | 61156 | 24354 | 16021 |
Svg | 47454 | 76 | 50 |
JavaScript | 42178 | 4356 | 3583 |
Makefile | 16103 | 6932 | 4054 |
Go | 13666 | 1943 | 1915 |
Sh | 10553 | 3540 | 2154 |
RPMSpecfile | 8892 | 360 | 1163 |
Autoconf | 8483 | 164 | 302 |
LLVM | 5081 | 142 | 770 |
Meson | 4907 | 609 | 696 |
Html | 4232 | 366 | 467 |
TypeScript | 2968 | 500 | 170 |
CMake | 2881 | 489 | 580 |
Glsl | 2559 | 636 | 448 |
Bash | 2264 | 720 | 441 |
Automake | 1940 | 87 | 412 |
Css | 1616 | 119 | 305 |
ModuleDef | 1218 | 0 | 82 |
Ruby | 995 | 256 | 233 |
Batch | 739 | 43 | 263 |
Perl | 698 | 268 | 82 |
LinkerScript | 692 | 21 | 11 |
ReStructuredText | 595 | 0 | 245 |
ObjectiveC | 450 | 72 | 83 |
FlatBuffers | 335 | 355 | 114 |
ObjectiveCpp | 331 | 72 | 74 |
Prolog | 131 | 27 | 22 |
FSharp | 35 | 0 | 10 |
MsBuild | 18 | 0 | 0 |
Lua | 15 | 0 | 4 |
DreamMaker | 0 | 0 | 0 |
Hex | 0 | 0 | 0 |
Happy | 0 | 0 | 0 |
D | 0 | 0 | 0 |
Dockerfile | 0 | 0 | 0 |
XSL | 0 | 0 | 0 |
DeviceTree | 0 | 0 | 0 |
Markdown | 0 | 21398 | 6792 |
Text | 0 | 340085 | 10720 |
Code | Comments | Blank | |
---|---|---|---|
Java | 347204 | 170093 | 78460 |
TypeScript | 30813 | 5491 | 3942 |
Bash | 28636 | 5205 | 4168 |
Batch | 21032 | 0 | 7717 |
Python | 17232 | 1861 | 3351 |
Sh | 15755 | 3066 | 2471 |
Kotlin | 15237 | 8012 | 3359 |
Cpp | 9336 | 1580 | 1653 |
Rust | 5430 | 451 | 527 |
JavaScript | 4181 | 2321 | 406 |
CHeader | 3817 | 2601 | 1556 |
Html | 3153 | 200 | 209 |
FreeMarker | 3104 | 610 | 614 |
Go | 2808 | 38 | 322 |
Protobuf | 1149 | 118 | 213 |
Prolog | 784 | 0 | 121 |
Makefile | 386 | 218 | 129 |
Vue | 192 | 0 | 62 |
Ruby | 183 | 9 | 43 |
CMake | 177 | 15 | 23 |
Sass | 164 | 61 | 44 |
C | 161 | 18 | 25 |
Sql | 140 | 1 | 4 |
Svg | 133 | 1 | 1 |
Css | 113 | 60 | 27 |
Perl | 90 | 1 | 12 |
Dockerfile | 62 | 2 | 7 |
ModuleDef | 31 | 2 | 4 |
AssemblyGAS | 12 | 15 | 5 |
Text | 0 | 19787 | 4572 |
Markdown | 0 | 18860 | 6535 |
Code | Comments | Blank | |
---|---|---|---|
Cpp | 13984266 | 2223594 | 2191526 |
C | 10989153 | 1956059 | 1800989 |
CHeader | 8343412 | 3474531 | 1667042 |
Rust | 3891385 | 185339 | 369972 |
Java | 3724938 | 1909706 | 673631 |
Python | 2433186 | 260352 | 373893 |
CppHeader | 2409435 | 448755 | 416157 |
AssemblyGAS | 1264251 | 91378 | 148896 |
Assembly | 504043 | 16459 | 45111 |
Protobuf | 497046 | 538489 | 193996 |
ReStructuredText | 490850 | 0 | 197535 |
Go | 299896 | 78276 | 34515 |
CMake | 296012 | 38688 | 32917 |
Autoconf | 251301 | 45080 | 40728 |
Kotlin | 224835 | 64806 | 36111 |
Sh | 219317 | 63742 | 37641 |
CSharp | 190775 | 39559 | 16865 |
VisualStudioProject | 183365 | 513 | 83 |
Perl | 169939 | 20959 | 20667 |
ObjectiveC | 147739 | 25959 | 26207 |
Html | 146854 | 13319 | 13624 |
JavaScript | 110164 | 16290 | 9224 |
ModuleDef | 101673 | 2103 | 6892 |
Makefile | 94464 | 26033 | 24987 |
TypeScript | 79005 | 19254 | 10603 |
ObjectiveCpp | 74436 | 8901 | 13905 |
Glsl | 58324 | 5284 | 13627 |
Svg | 33923 | 160 | 17 |
Css | 30465 | 1886 | 5159 |
Meson | 30144 | 2366 | 3615 |
Sql | 30004 | 11490 | 2080 |
Happy | 26542 | 0 | 3239 |
Tex | 25972 | 12696 | 3177 |
Php | 24518 | 21790 | 5741 |
Lua | 23389 | 1994 | 2012 |
Automake | 20654 | 2990 | 2954 |
Ruby | 20432 | 7268 | 4035 |
DeviceTree | 19703 | 2293 | 3037 |
Bash | 16928 | 6158 | 3433 |
VisualStudioSolution | 15903 | 0 | 38 |
OCaml | 15174 | 2752 | 1625 |
Batch | 14797 | 1568 | 3682 |
Pascal | 12342 | 3125 | 2117 |
Swig | 10844 | 462 | 1720 |
Dockerfile | 9394 | 4588 | 2739 |
Swift | 9128 | 2366 | 987 |
FlatBuffers | 7612 | 3666 | 2136 |
FortranLegacy | 7163 | 7907 | 33 |
Pan | 7122 | 542 | 692 |
D | 6540 | 479 | 375 |
Sass | 5790 | 869 | 770 |
RPMSpecfile | 5627 | 129 | 582 |
Alex | 3731 | 0 | 764 |
ActionScript | 3567 | 2608 | 746 |
MsBuild | 3502 | 446 | 235 |
XSL | 3371 | 502 | 364 |
VB6 | 3091 | 651 | 404 |
Dart | 2744 | 411 | 491 |
Hex | 2426 | 0 | 133 |
R | 2332 | 989 | 585 |
OpenType | 2157 | 289 | 339 |
Ada | 2054 | 457 | 441 |
Velocity | 2037 | 468 | 525 |
Groovy | 1774 | 1715 | 434 |
Hlsl | 1703 | 72 | 287 |
PowerShell | 1545 | 568 | 291 |
Scons | 1473 | 284 | 354 |
Prolog | 1104 | 0 | 156 |
LinkerScript | 1060 | 57 | 80 |
Julia | 930 | 473 | 143 |
LLVM | 866 | 19 | 35 |
Elisp | 772 | 516 | 241 |
VimScript | 770 | 96 | 86 |
Processing | 724 | 89 | 32 |
Rakefile | 696 | 81 | 112 |
Lisp | 502 | 81 | 109 |
Tsx | 457 | 99 | 53 |
Arduino | 389 | 38 | 56 |
Pest | 289 | 72 | 83 |
Handlebars | 281 | 0 | 27 |
Stratego | 223 | 0 | 14 |
Nix | 185 | 2 | 22 |
DotNetResource | 174 | 195 | 1 |
Gherkin | 133 | 14 | 32 |
CShell | 129 | 20 | 22 |
RubyHtml | 102 | 0 | 25 |
XcodeConfig | 95 | 208 | 29 |
Jsonnet | 93 | 108 | 12 |
Zig | 73 | 0 | 10 |
ABNF | 69 | 1 | 23 |
FortranModern | 56 | 0 | 4 |
Graphql | 51 | 0 | 0 |
Fish | 42 | 14 | 13 |
VBScript | 12 | 0 | 3 |
AsciiDoc | 6 | 2 | 2 |
Zsh | 4 | 26 | 2 |
Tcl | 4 | 0 | 0 |
Scala | 0 | 0 | 0 |
FSharp | 0 | 0 | 0 |
Text | 0 | 19146293 | 186135 |
RON | 0 | 0 | 0 |
GDB | 0 | 0 | 0 |
Asn1 | 0 | 0 | 0 |
Less | 0 | 0 | 0 |
Forth | 0 | 0 | 0 |
Fstar | 0 | 0 | 0 |
SpecmanE | 0 | 0 | 0 |
Jupyter | 0 | 0 | 0 |
Markdown | 0 | 351987 | 123491 |
Code | Comments | Blank | |
---|---|---|---|
Rust | 338973 | 4160 | 5349 |
Java | 334887 | 131969 | 60094 |
Go | 159363 | 36614 | 31461 |
Python | 104113 | 11674 | 15446 |
Kotlin | 46886 | 18451 | 7649 |
Makefile | 29133 | 11434 | 6029 |
Cpp | 17433 | 4215 | 3508 |
Sh | 7826 | 2989 | 1602 |
CHeader | 6248 | 3319 | 1742 |
Perl | 6188 | 602 | 773 |
C | 4181 | 1145 | 699 |
Protobuf | 3395 | 2742 | 1028 |
Css | 3221 | 155 | 599 |
JavaScript | 3009 | 258 | 246 |
TypeScript | 2421 | 455 | 217 |
Svg | 1661 | 9 | 7 |
Bash | 1288 | 1269 | 414 |
AssemblyGAS | 1100 | 255 | 167 |
Html | 979 | 37 | 83 |
VisualStudioProject | 876 | 0 | 0 |
Batch | 699 | 84 | 222 |
CSharp | 670 | 1 | 83 |
CMake | 552 | 116 | 88 |
XSL | 398 | 34 | 42 |
CppHeader | 159 | 61 | 47 |
Elisp | 110 | 3 | 18 |
VisualStudioSolution | 82 | 0 | 2 |
Pan | 61 | 5 | 11 |
Dockerfile | 38 | 3 | 8 |
Autoconf | 3 | 0 | 0 |
DeviceTree | 0 | 0 | 0 |
Arduino | 0 | 0 | 0 |
Text | 0 | 89034 | 6625 |
Assembly | 0 | 0 | 0 |
Glsl | 0 | 0 | 0 |
DreamMaker | 0 | 0 | 0 |
FSharp | 0 | 0 | 0 |
Markdown | 0 | 5666 | 1874 |
Cobol | 0 | 0 | 0 |
Code | Comments | Blank | |
---|---|---|---|
Java | 2740222 | 870461 | 458470 |
Cpp | 501530 | 102902 | 90100 |
Kotlin | 175877 | 54173 | 26060 |
CHeader | 131425 | 100681 | 38990 |
Rust | 97602 | 9095 | 14711 |
Python | 40617 | 3603 | 7218 |
C | 19693 | 4656 | 3523 |
Protobuf | 12988 | 6554 | 4683 |
RPMSpecfile | 7809 | 0 | 295 |
Sh | 3868 | 1314 | 920 |
Bash | 2130 | 227 | 321 |
Makefile | 1359 | 3175 | 444 |
Html | 1256 | 34 | 120 |
DeviceTree | 441 | 8 | 37 |
Batch | 392 | 0 | 133 |
Groovy | 384 | 54 | 64 |
Css | 366 | 120 | 23 |
AssemblyGAS | 336 | 220 | 88 |
Lua | 311 | 15 | 40 |
FlatBuffers | 299 | 72 | 55 |
CMake | 242 | 7 | 45 |
CSharp | 179 | 8 | 37 |
JavaScript | 136 | 50 | 25 |
LLVM | 106 | 0 | 24 |
Prolog | 70 | 0 | 9 |
Dockerfile | 60 | 18 | 7 |
Glsl | 55 | 19 | 13 |
CppHeader | 38 | 68 | 19 |
LinkerScript | 16 | 0 | 2 |
Autoconf | 15 | 0 | 2 |
Markdown | 0 | 4632 | 1462 |
Text | 0 | 58001 | 3437 |
SRecode | 0 | 0 | 0 |
Sql | 0 | 0 | 0 |
TypeScript | 0 | 0 | 0 |
Perl | 0 | 0 | 0 |
Code | Comments | Blank | |
---|---|---|---|
Cpp | 13797569 | 1339462 | 1728433 |
CHeader | 10171784 | 346968 | 174971 |
Java | 9591246 | 1804891 | 1764810 |
Python | 2896676 | 304800 | 501185 |
C | 2000847 | 474412 | 393535 |
Assembly | 1800654 | 65 | 60316 |
Kotlin | 727274 | 125977 | 111043 |
LLVM | 698946 | 503609 | 161851 |
Html | 693207 | 11964 | 11267 |
Rust | 565184 | 31456 | 76542 |
Go | 501280 | 38043 | 50517 |
TypeScript | 340020 | 94278 | 6402 |
Sh | 311607 | 92151 | 65214 |
AssemblyGAS | 207480 | 108735 | 61571 |
CppHeader | 186979 | 15026 | 23488 |
CSharp | 127862 | 6511 | 11532 |
Autoconf | 116579 | 2668 | 8793 |
Glsl | 72231 | 57 | 1041 |
VisualStudioProject | 64489 | 50 | 28 |
ObjectiveC | 61039 | 71952 | 16871 |
Protobuf | 57795 | 29442 | 13889 |
Groovy | 46852 | 25188 | 12710 |
FortranLegacy | 38674 | 15550 | 78 |
XSL | 38083 | 56395 | 16031 |
ObjectiveCpp | 30503 | 26014 | 8205 |
Perl | 26872 | 7725 | 4754 |
Php | 26793 | 11303 | 5253 |
CMake | 25676 | 5389 | 4255 |
Ruby | 25490 | 1756 | 4402 |
Hlsl | 24292 | 20 | 1920 |
Makefile | 22202 | 11475 | 8018 |
JavaScript | 20302 | 2739 | 2830 |
Bash | 14480 | 8792 | 3380 |
DeviceTree | 14431 | 3624 | 764 |
ReStructuredText | 13839 | 0 | 5497 |
Automake | 9982 | 853 | 2208 |
Swift | 8600 | 385 | 1119 |
Dart | 7574 | 186 | 938 |
DreamMaker | 6928 | 1342 | 1 |
Forth | 6709 | 54 | 12 |
Dockerfile | 6161 | 4431 | 2194 |
Lua | 4861 | 944 | 949 |
AsciiDoc | 4146 | 263 | 802 |
Batch | 3899 | 96 | 954 |
Css | 3761 | 160 | 633 |
Svg | 3584 | 52 | 18 |
Meson | 3062 | 478 | 363 |
Sql | 2930 | 1130 | 334 |
Velocity | 2630 | 603 | 783 |
OCaml | 2617 | 551 | 617 |
Prolog | 2157 | 135 | 185 |
FlatBuffers | 2035 | 443 | 471 |
D | 1885 | 0 | 14 |
VisualStudioSolution | 1597 | 0 | 10 |
Fstar | 1419 | 0 | 0 |
Scons | 1178 | 278 | 459 |
R | 1078 | 553 | 368 |
Cobol | 725 | 0 | 0 |
Happy | 663 | 0 | 3204 |
Hex | 648 | 0 | 2 |
ModuleDef | 633 | 20 | 55 |
MsBuild | 630 | 58 | 63 |
Sass | 495 | 9 | 111 |
Ada | 354 | 103 | 162 |
LinkerScript | 209 | 0 | 32 |
FSharp | 193 | 0 | 49 |
OpenType | 176 | 1 | 24 |
ActionScript | 148 | 10 | 46 |
Arduino | 132 | 2 | 23 |
Pest | 114 | 39 | 29 |
Alex | 64 | 0 | 1 |
Pan | 56 | 6 | 8 |
FreeMarker | 51 | 0 | 10 |
GDB | 44 | 64 | 20 |
Rakefile | 36 | 2 | 12 |
Scala | 29 | 46 | 15 |
Elisp | 24 | 16 | 4 |
RON | 24 | 0 | 0 |
PowerShell | 20 | 5 | 7 |
FortranModern | 18 | 260 | 3 |
Tex | 16 | 0 | 10 |
Tcl | 11 | 6 | 6 |
Asn1 | 10 | 0 | 4 |
SRecode | 4 | 0 | 0 |
Pascal | 1 | 0 | 0 |
SpecmanE | 1 | 0 | 0 |
Markdown | 0 | 63989 | 22466 |
Text | 0 | 13618312 | 369669 |
VBScript | 0 | 2 | 0 |
Code | Comments | Blank | |
---|---|---|---|
Html | 10974672 | 583388 | 179733 |
ReStructuredText | 362633 | 0 | 100966 |
JavaScript | 44137 | 9618 | 10039 |
Css | 40443 | 3525 | 4623 |
Svg | 37831 | 352 | 93 |
Cpp | 24665 | 4239 | 1577 |
AsciiDoc | 15438 | 578 | 4479 |
Python | 10482 | 5172 | 3203 |
C | 9758 | 6376 | 2632 |
Autoconf | 8825 | 20612 | 8057 |
Tex | 7119 | 2734 | 1388 |
Java | 6634 | 967 | 1077 |
XSL | 5752 | 456 | 397 |
Less | 5538 | 1533 | 1178 |
Sass | 5192 | 204 | 550 |
RPMSpecfile | 3475 | 2 | 1723 |
VisualStudioProject | 2658 | 0 | 0 |
Makefile | 2504 | 344 | 565 |
Php | 1779 | 1 | 8 |
Batch | 1530 | 15 | 240 |
Perl | 1144 | 406 | 303 |
Sh | 1133 | 320 | 237 |
CMake | 869 | 246 | 134 |
Kotlin | 858 | 147 | 95 |
Automake | 693 | 305 | 208 |
Meson | 599 | 36 | 88 |
Velocity | 403 | 30 | 91 |
Bash | 339 | 143 | 94 |
Protobuf | 232 | 30 | 30 |
CHeader | 160 | 447 | 65 |
Rust | 93 | 0 | 30 |
Go | 53 | 11 | 7 |
Ruby | 35 | 31 | 11 |
Lua | 4 | 2 | 0 |
Text | 0 | 103949 | 20253 |
Markdown | 0 | 234340 | 85049 |