If comments in java files are removed as part of apk creation, how the log statements are able to print the correct line number? Could someone please explain? I have seen the same behavior in java files as well when they are compiled.
Asked
Active
Viewed 907 times
1 Answers
7
Comments are not preserved in the APK. The APK contains the compiled byte code for the classes in your application and this byte code does not contain source code comments.
The byte code does preserve some information about the source code, such as method names, to be used when generating stack traces. This may, or may not include accurate line numbers. See:

Community
- 1
- 1

Malcolm Smith
- 3,540
- 25
- 29