How to remove all debug logging calls before building the release version of an Android app?

前端 未结 27 1537
有刺的猬
有刺的猬 2020-11-22 07:39

According to Google, I must \"deactivate any calls to Log methods in the source code\" before publishing my Android app to Google Play. Extract from section 3 of th

27条回答
  •  情话喂你
    2020-11-22 08:24

    Logs can be removed using bash in linux and sed:

    find . -name "*\.java" | xargs sed -ri ':a; s%Log\.[ivdwe].*\);%;%; ta; /Log\.[ivdwe]/ !b; N; ba'
    

    Works for multiline logs. In this solution you can be sure, that logs are not present in production code.

提交回复
热议问题