This almost works for me. Unfortunately I tend to type gradle shorted commands ( for example assembleDe instead of assembleDebug). I noticed that
getTaskRequests shows what I typed on command line, before resolving to the full task name, so this will be a deal braker for me.
I also noticed that I don’t need to skip the classpath declaration on my plugin version (specified as 5.+, resolved as 5.22.0 today).
I went instead with the solution from https://stackoverflow.com/questions/31379795/how-to-apply-plugin-to-only-one-flavor-in-gradle where a flag is introduced either at command line, or as I prefer, added to ~/.gradle/gradle.properties (in my case the presence of the flag skips new relic, so CI will enable it by default).
I’ll also rant a little bit since I’m here. I have used this product in the past, but for backend spring microservices. One more time I’m deeply disappointed with this company. It’s hard for me to believe there’s a legitimate reason to apply changes to builds where NO file was modified. It creates lots of problems, including totally breaking instant run in my case. The problem is compounded by the lack of straigthforward official support for turning this nasty behaviour off.
If it was for me no company would use New Relic at all. But devs rarely get a say, and it’s too easy to get away with post sales problems that decision makers don’t have to put up with.