title: Multiple Gradle duplicate classes after excluding module from the dependency
body: <p>Gradle file includes the following dependencies</p>
  
  <pre><code>dependencies {
      implementation fileTree(include: ['*.jar'], dir: 'libs')
      implementation 'androidx.appcompat:appcompat:1.0.2'
      implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
      implementation 'com.google.android.material:material:1.0.0'
      testImplementation 'junit:junit:4.12'
      androidTestImplementation 'androidx.test:runner:1.1.1'
      androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
  
      implementation 'javax.xml.bind:jaxb-api:2.2.12'
      implementation 'javax.xml.stream:stax-api:1.0-2'
      implementation 'com.fasterxml:aalto-xml:1.0.0'
  
      implementation group: 'xerces', name: 'xercesImpl', version: '2.8.0'
  
      implementation 'com.google.android.gms:play-services-auth:15.0.1'
      implementation 'pub.devrel:easypermissions:0.3.0'
      implementation('com.google.api-client:google-api-client-android:1.23.0') {
          exclude group: 'org.apache.httpcomponents', module: 'commons-codec'
      }
      implementation('com.google.apis:google-api-services-gmail:v1-rev83-1.23.0') {
          exclude group: 'org.apache.httpcomponents'
      }
      implementation 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
  }
  </code></pre>
  
  <p>Amongst several other multiple class errors, <code>commons-codec</code> has the following usage in the dependency tree</p>
  
  <pre><code>+--- com.google.api-client:google-api-client-android:1.23.0
  |    +--- com.google.api-client:google-api-client:1.23.0
  |    |    +--- com.google.oauth-client:google-oauth-client:1.23.0
  |    |    |    +--- com.google.http-client:google-http-client:1.23.0
  |    |    |    |    +--- com.google.code.findbugs:jsr305:1.3.9
  |    |    |    |    \--- org.apache.httpcomponents:httpclient:4.0.1
  |    |    |    |         +--- org.apache.httpcomponents:httpcore:4.0.1
  |    |    |    |         +--- commons-logging:commons-logging:1.1.1
  |    |    |    |         \--- commons-codec:commons-codec:1.3
  \--- commons-codec:commons-codec:{strictly 1.3} -&gt; 1.3 (c)
  </code></pre>
  
  <p>Figure the problem might be related to a transitive dependency but as far as I can understand through the analysis of the dependency tree, only <code>org.apache.httpcomponents</code> is using it as a library and yet, for some reason I can't grasp, the exclude declaration in the Gradle build file is not working as intended. </p>
  
  <p>Gradle build log related to the <code>commons-codec</code> module</p>
  
  <pre><code>  Duplicate class org.apache.commons.codec.BinaryDecoder found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.BinaryEncoder found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.Decoder found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.DecoderException found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.Encoder found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.EncoderException found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.StringDecoder found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.StringEncoder found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.StringEncoderComparator found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.binary.Base64 found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.binary.BinaryCodec found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.binary.Hex found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.digest.DigestUtils found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.language.DoubleMetaphone found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.language.DoubleMetaphone$DoubleMetaphoneResult found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.language.Metaphone found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.language.RefinedSoundex found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.language.Soundex found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.language.SoundexUtils found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.net.BCodec found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.net.QCodec found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.net.QuotedPrintableCodec found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.net.RFC1522Codec found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
    Duplicate class org.apache.commons.codec.net.URLCodec found in modules commons-codec-1.3.jar (commons-codec:commons-codec:1.3) and docx4j-6.1.1-SNAPSHOT-shaded.jar (docx4j-6.1.1-SNAPSHOT-shaded.jar)
  </code></pre>
  
  <p>Note that <code>docx4j-6.1.1-SNAPSHOT-shaded.jar</code> is a jar added to the libs folder. Not sure why those jar files are not being displayed in the dependency tree.</p>