Search code examples
androidperformanceandroid-studioprintingprocessing-efficiency

How does an Android Studio deal with System.out.print functions when making a final version of an app?


My question is simple. If I make an app with android studio leaving in print functions, will they run when I run the app and take up computational power? or will android studio automatically get rid of them? Or do they stay there but not run due to a lack of a console to print to?

Basically: Do I need to get rid of print functions in android studio in order to have my app running at its highest performance capabilities?

Thank you very much.

Edit: I should mention that I am using a library that prints numerous diagnostic pieces of information, and it would be a bit of a project in itself to try to remove the System.out.print functions from this library. This is why I am asking specifically about print functions.


Solution

  • Yes you should get rid of print statements otherwise they will affect performance. A better solution to this is to use Timber library by Jake Wharton. This library takes care of removing log statements for release builds automatically. Also this library has some pretty good APIs to improve logging workflows.