43

Me: Yes! I'm finally ready to upload my first Android app to PlayStore, im so excited!!

Google: Make sure to remove all the Log calls from your code.

Me: *Finds out that there's no way Android studio can make it for you*
FUUUUUUUU**

Comments
  • 8
    Write a script to loop through your app folders, find .java files and replace the line with "Log.".
    GG
  • 11
    You don't have to remove logs if you don't have any *insert in that popular meme format*
  • 1
    +1 on what @mohammed suggested. Can be easily done with a bash script and sed, maybe?

    But I cant believe Android Studio or any plugins cant do this already.... really?
  • 3
    @SmartCoder use proguard for doing this
  • 0
    rpl is a gnu tool created for this! It supports globbing file patterns and replaces strings :)
  • 0
    @him- this.
    There is a configuration for removing all log calls when building the app
  • 0
    Try ctrl+shift+r for replacing across project?
    Works in pycharm I'm guessing it may work in Android studio
    No idea about android
  • 1
    sed and awk to the rescue
  • 0
    A text editor's find in files (and replace in files) feature can make quick work of that. Try Sublime or notepad++ or....
  • 0
    Make a custom logging function, call the custom function everywhere and Log only inside the custom function. Then you can just have a flag that makes it so Log doesn't get called if it's a production build.

    (I don't develop for Android so idk if this is actually practical but this is what's been done on every decent project I've ever worked on. It's nice because it lets you easily customize the logging behavior in one place.)
Add Comment