I need to make different flavors for test libraries. Why? Well, I want project to be fully secured so I wanna minifying to be enabled all the time(even for debug build type).
While making tests I'm using different classes from project, so I decided to change proguard files using flavor. It looks like something this :
android {
...
buildTypes {
release {
minifyEnabled true
testProguardFile 'test-proguard-rules.pro'
}
debug {
minifyEnabled true
testProguardFile 'test-proguard-rules.pro'
}
}
...
productFlavors{
forTest{
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules1.pro', 'debug-rules.pro'
}
forRelease{
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'debug-rules.pro'
}
}
}
And proguard-rules* files
proguard-rules:
-dontwarn blablabla.**
-dontwarn blabla.**
-keep class bla.** { *; }
proguard-rules1:
-dontshrink
-dontobfuscate
-dontwarn
But this wasn't helpful for me. I want to run tests without obfuscation. Flavors doesn't have such param as minifyEnabled so I try to find any solution. So any suggestions about resolving an issue? May be someone had the same problem and find another solution (not using flavors) ?
After a whole day messing with this I found the following works: