4

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.

William Derksen
  • 115
  • 3
  • 6

3 Answers3

1

well you should Make sure you deactivate logging and disable the debugging option before you build your application for release.

For me, logging is far too important to remove from the source, but it must be removed from the production application, for performance, secure and intellectual property reasons.

Atiq
  • 14,435
  • 6
  • 54
  • 69
  • So deactivating logging, prevents android from releasing codes with logging in it? Would it do the same to any print functions in the code? (System.out.print()) – William Derksen Jun 10 '16 at 17:11
1

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.

NinjaCoder
  • 2,381
  • 3
  • 24
  • 46
0
System.out.print 

It is same as Log like Log.e() or Log.i() or Log.d()

When you have this logcats in your final APK then when it runs it will prints that statements in the Android Moniter and this will be helpfull to know what is happening in the app.

Vishwesh Jainkuniya
  • 2,821
  • 3
  • 18
  • 35