title: Android Studio: how to exclude specific package of an depended library?
body: <p>For example, I want to replace the implementation of Mp4Extractor(a final class) in Exoplayer with my own version. How can I achieve this?</p>
  
  <p>Something like (which does not exist now): </p>
  
  <pre><code>implementation 'com.google.android.exoplayer:exoplayer-core:2.8.4' {
      exclude package: 'com.google.android.exoplayer.extractor.mp4'
  }
  </code></pre>
  
  <p>This is different from excluding certain java classes in the source tree, but from the remote library.
  P.S. I have already tried as suggested on <a href="https://developer.android.com/studio/build/dependencies" rel="nofollow noreferrer">https://developer.android.com/studio/build/dependencies</a> but it does not work.</p>
  
  <pre><code>implementation ( 'com.google.android.exoplayer:exoplayer-core:2.8.4' ){
      exclude group: 'com.google.android.exoplayer:exoplayer-core', module: 'mp4'
  }
  </code></pre>
  
  <p>The purpose is to patch the Mp4Extractor implementation in the library for new codec supporting without modifying other classes which use "com.google.android.exoplayer.extractor.mp4".</p>
  
  <p>Does anyone have a good idea?</p>