In 2025 use this:
configurations.all { exclude(group = "com.google.android.gms", module = "play-services-safetynet") }