0

I have read Best way to include debug code for including debug only code in android and was really helpful. what I'm asking and couldn't find answer for is:

Is debug only code suggested by above solutions completely removed from release type apk?

Community
  • 1
  • 1
Masked Man
  • 2,176
  • 2
  • 22
  • 41

1 Answers1

0

By using the method described in the suggested answer of the link you provided, the debug only code is removed by the compiler from the release type apk when setting DEV_MODE=false.

If you need to have automatic switching between debug and release code without having to remember to set a constant variable, you will have to add a debug folder next to your main folder in your src and re-implement any class you need to modify.

Elias N
  • 1,430
  • 11
  • 19
  • In documentation android says that by using proguard it will remove unused code from the generated apk and by the solution in that question the code will never be reached in release mode! – Masked Man Sep 22 '16 at 08:50
  • *...the debug only code is not removed from the release* ... not true ... `if(someStaticFINALBoolFalse) { /* the code*/ }` `the code` will not be compiled into artifact – Selvin Sep 22 '16 at 08:54
  • @Selvin you're right.. the compiler (not proguard) will actually remove the code... i was thinking more of an "automatic" solution rather than setting a true/false variable. – Elias N Sep 22 '16 at 09:02
  • @Selvin, you mean that by the approached mentioned I will not get my debug code in the release apk? – Masked Man Sep 22 '16 at 16:41