3

We usually put logs to check if some code block executes or not. But we generally don't remove it before publishing the app.I don'y know about other but i have fond of that feature and using it fluently in my apps.Can any one tell me that what will be the effect on system memory of writing any of the Log.x() (where X=v,e,w,i,d) forms. Do anyone help me clear some concepts?

kaushal trivedi
  • 3,405
  • 3
  • 29
  • 47

4 Answers4

4

Definitely there will be a lot of effect on Memory usage, APK file size and Performance.

Besides, You must remove all the Logs before publishing the app.

Of course, once you remove all the Logs and publish it, its pain to rewrite them.

Hence use Proguard which removes all the Logs from the ByteCode, but doesn't effect the source code.

Apart from removing Logs, Proguard helps in performance enhancement by Obfuscating you code, removing unused methods, variables etc.. All that depends on how you configure it.

Enabling ProGuard in Eclipse for Android

How to avoid reverse engineering of an APK file?

Community
  • 1
  • 1
Archie.bpgc
  • 23,812
  • 38
  • 150
  • 226
  • @Archie.bpgc: Though if we use proguard, it's easy to extract code. Google's Android app is little bit week on that part. :) – Shadow Feb 07 '13 at 09:35
  • Yep. But something is better than nothing. And my intention was to say `Proguard isn't just to remove logs` :) – Archie.bpgc Feb 07 '13 at 09:37
1

The logs get saved in memory.thereby consuming memory space.We should remove the debug logs before releasing ,Only error logs should be there.

Payal
  • 903
  • 1
  • 9
  • 28
1

YES Definately. And To make Logs efficient always try to use a Boolean flag like:

boolean debug = true or false;

and wherever you use log.d("ClassName","message"); write it as

if(debug) log.d("ClassName","message");

and so you can manage the logging(Logs) with a single Boolean flag.

thanks.

Shridutt Kothari
  • 7,326
  • 3
  • 41
  • 61
  • Just to follow up - the addition of the boolean tag, when set to false, adds minimal overhead in checking the conditional for each debug statment? – Rarw Mar 04 '13 at 19:32
0

It depends on how many logs you use. Surely it will affect the application.So before releasing app, use this.

android:debuggable="false"

Shadow
  • 6,864
  • 6
  • 44
  • 93