I use proguard for both versions of debugging and release to avoid multidex.
My build.gradle file is as follows:
debug { minifyEnabled true proguardFiles 'proguard_debug.pro' signingConfig signingConfigs.debug debuggable true } release { minifyEnabled true proguardFiles 'proguard_release.pro' signingConfig signingConfigs.release debuggable false }
To minimize the differences between debugging and release, as well as to properly debug the debug build, the proguard_debug.pro file contains the following security instructions:
-include proguard_release.pro -dontobfuscate -dontoptimize -keep class my.package.name.** {*; }
Thus, I support only one proguard configuration (in proguard_release.pro ), and the debug version is built using the same configuration, but without obfuscating the code.
This configuration solves all of these issues:
- There is no need for multidex (so there is no dilemma whether to use it with API 21+ and you can use Espresso)
- Debug and release builds are the same, except that the debug build does not obfuscate your code
source share