About 1 time in 3 when doing a build with Gradle I get:

A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
... a thousand lines later...
Caused by: java.lang.OutOfMemoryError: Java heap space

And then the next time it works. So that's exactly the level of quality I've come to expect from Gradle in particular and everything about Android in general.

A Gradle play in two acts.

Act 1:

WARNING: The property android.dependency.excludeLibraryComponentsFromConstraints improves project import performance for very large projects. It should be enabled to improve performance.

Act 2:

WARNING: The option setting 'android.dependency.excludeLibraryComponentsFromConstraints=true' is deprecated.

@jwz it is extremely on brand that improving performance is deprecated.