Yes, you can use ProGuard to minimize debug builds.
The key is to use the -dontobfuscate in the ProGuard configuration to build debugging.
Use this parameter in build.gradle :
buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-rules-debug.pro' } }
Write your version of ProGuard configuration in proguard-rules.pro .
Use the same configuration for release and debugging. This way you guarantee that the code you need will not be deleted. And minimizing debugging doesn't break the build.
Add the optional ProGuard configuration file proguard-rules-debug.pro to build debugging. It should contain rules used only for debugging. In this case, add only:
-dontobfuscate
Tomik source share