title: Program type already present ( duplicate class error)
body: <p>After include bar-code scanner library. when I try to rebuild my app. I'm getting error <strong>"Program type already present: com.google.gson.gsonNull"</strong> 
  I'm spending lot of time to resolve this issue but unable to resolve this. I've seen lot of question about this but could not found any solution.</p>
  
  <p>I've try this on Android studio 3.2.1 and Android studio 3.1.3 </p>
  
  <p>I read official document of this error:  <a href="https://developer.android.com/studio/build/dependencies#duplicate_classes" rel="nofollow noreferrer">Link</a></p>
  
  <p>I'm also figure out my duplicate classes (Retrofit and Scanner Library). But I don't want to remove any library either. So, I've started to exclude "gson" which is mention in different question's answer. </p>
  
  <pre><code>  configurations {
          all*.exclude group: 'com.google.code.gson'
      }
  </code></pre>
  
  <p>that solve my problem but then I'm unable to call API's. Because its not converted to gson. Here my library that include duplicate classes. </p>
  
  <pre><code>  implementation "com.squareup.retrofit2:retrofit:2.4.0"
    implementation "com.squareup.retrofit2:converter-gson:2.4.0"
    implementation project(':barcode_scanner_library_v2.4.2.0')
  </code></pre>
  
  <p>I'm also try to exclude explicitly just like.</p>
  
  <pre><code> implementation (project(':barcode_scanner_library_v2.4.2.0')){
              exclude module: 'gson'
    }
  </code></pre>
  
  <p>but this is not working.</p>
  
  <p>This problem may be solve after I'm implement retrofit with jackson. But its time taking solution. </p>