title: Excluding the same group from multiple dependencies in gradle?
body: <p>I have the following code in the build.gradle in the app module of my Android project</p>
  
  <pre><code>implementation('com.google.firebase:firebase-core:16.0.1', {
      exclude group: 'com.android.support'
  })
  implementation('com.google.firebase:firebase-database:16.0.1', {
      exclude group: 'com.android.support'
  })
  implementation('com.google.firebase:firebase-auth:16.0.1', {
      exclude group: 'com.android.support'
  })
  implementation('com.google.firebase:firebase-crash:16.0.1',  {
      exclude group: 'com.android.support'
  })
  </code></pre>
  
  <p>The firebase libraries all contain a conflicting version of the android support library which I am using and so I need to exclude it to prevent the build warning</p>
  
  <pre><code>All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 26.1.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1) 
  There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).
  </code></pre>
  
  <p>Is there a way I can group these implementation statements together so I only need to write one exclude statement?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>My specific solution based on Cris' answer</p>
  
  <pre><code>configurations.all {
      resolutionStrategy.eachDependency { DependencyResolveDetails details -&gt;
          if (details.requested.group == 'com.android.support') {
              details.useVersion '27.1.1'
          }
      }
  }
  
  dependencies {
      implementation 'com.android.support:appcompat-v7:27.1.1'
      implementation 'com.google.firebase:firebase-core:16.0.1'
      implementation 'com.google.firebase:firebase-database:16.0.1'
      implementation 'com.google.firebase:firebase-auth:16.0.1'
      implementation 'com.google.firebase:firebase-crash:16.0.1'
  }
  </code></pre>