Hey there, I know that this is quite common to do, but I think that would be good a small recipe on how to setup LeakCanary for different product flavors on build.gradle.
[EDIT] Sorry about the "Hey guys, my bad.
Thanks, that's an interesting idea!
Can you provide me with examples of why you'd want a different LeakCanary configuration depending on the product flavors? What is it that you (or someone) might be trying to achieve?
Note: "Hey guys" is not an inclusive statement and we refrain from using it in this community. Thanks!
The reason that I want a different configuration for the LeakCanary is that we have 3 product flavors in our project, dev, qa and prod. By setting the default debugImplementation for LeakCanary it will run on every debug product flavor, but our QA team ask us to disable LeakCanary for them because it was impacting some test scenarios, and also we have to record a demo for the client and for that we want the LeakCanary disabled too. Here is how I did it.
flavorDimensions "app"
productFlavors {
dev {}
qa {}
prod {}
}
configurations {
devDebugImplementation {}
}
...
dependencies {}
devDebugImplementation 'com.squareup.leakcanary:leakcanary-android:<current_version>'
Looks like this could be a good contribution to https://github.com/square/leakcanary/blob/master/docs/recipes.md . Feel free to open a PR :)
Merged, published on next release.