Start a Project

How to remove logs from your android application

If anyone downloads your app from Play Store, starts the app, connects the phone with android studio and read the logs from the app in the android monitor. Now that’s a security issue, Nobody is supposed to read the logs or any other information from the application without the permission of the owner.

The solution you are looking for is “ProGuard”.

Yes, apart from code shrinking and obfuscating ProGuard is also able to remove all the logs from the application before you create an APK.

All you need to do is make some changes in your proguard-rules.pro file

Add the above code segment in your proguard-rules.pro and it will automatically remove all the function with name d and v.

assumenosideeffects : Specifies methods that don’t have any side effects (other than maybe returning a value). In the optimisation step, ProGuard will then remove calls to such methods, if it can determine that the return values aren’t used. ProGuard will analyse your program code to find such methods automatically.

 

NOTE : -assumenosideffects is “Only applicable when optimising”

 

That’s all you need to make your application logs free.

Thank you very much, This is Vedesh Kumar signing off.

Exit mobile version