Fixes "task with that name already exists" error when using productFlavors

The following message is displayed when a project is using more than one productFlavors or buildTypes:
"Cannot add task ':AnApp:testClasses' as a task with that name already exists."

This merge request fixes it.