Why shouldn't I use System.out.println() in android

后端 未结 7 1134
无人共我
无人共我 2020-11-29 07:45

In the Android Open Source Project\'s code style, it states that we shouldn\'t use System.out.println() but I don\'t understand why. Can anyone explain? What sh

7条回答
  •  伪装坚强ぢ
    2020-11-29 08:08

    From your own link:

    System.out.println() (or printf() for native code) should never be used. System.out and System.err get redirected to /dev/null, so your print statements will have no visible effects. However, all the string building that happens for these calls still gets executed.

    In addition, at the beginning of that page, it says:

    The rules below are not guidelines or recommendations, but strict rules. Contributions to Android generally will not be accepted if they do not adhere to these rules.

    So DON'T do it!

提交回复
热议问题