title: Exclude project from a dependency in Gradle
body: <p>I'd like to exclude some unused dependencies to reduce my app size. Here are the dependencies in my module:</p>
  
  <pre><code>    +--- project :ProjectOne
  |    +--- commons-io:commons-io:2.4
  |    \--- project :ProjectTwo
  |         +--- com.project:PackJPG:1.5
  |         +--- com.project:xz:1.2
  |         +--- org.ocpsoft.prettytime:prettytime:2.1.2.Final
  |         +--- joda-time:joda-time:2.1
  |         +--- project :ProjectThree
  |         |    +--- project :Utilities
  |         |    +--- project :ProcessPriority
  |         |    |    +--- com.nativelibs4java:bridj:0.6.2
  |         |    |    |    \--- com.google.android.tools:dx:1.7
  |         |    |    +--- net.java.dev.jna:jna:4.1.0
  |         |    |    +--- net.java.dev.jna:jna-platform:4.1.0
  |         |    |    |    \--- net.java.dev.jna:jna:4.1.0
  |         |    |    +--- org.tinylog:slf4j-binding:1.2
  |         |    |    |    +--- org.tinylog:tinylog:1.2
  |         |    |    |    \--- org.slf4j:slf4j-api:[1.6,1.8) -&gt; 1.7.25
  |         |    |    \--- project :Utilities
  |         |    +--- project :ProjectFour
  |         |    |    +--- commons-logging:commons-logging:1.2
  |         |    |    +--- org.tinylog:jcl-binding:1.2
  |         |    |    |    +--- org.tinylog:tinylog:1.2
  |         |    |    |    \--- commons-logging:commons-logging:[1.2,1.3) -&gt; 1.2
  |         |    |    \--- commons-codec:commons-codec:1.10
  |         |    +--- org.slf4j:log4j-over-slf4j:1.7.25
  |         |    |    \--- org.slf4j:slf4j-api:1.7.25
  |         |    +--- org.slf4j:jul-to-slf4j:1.7.25
  |         |    |    \--- org.slf4j:slf4j-api:1.7.25
  |         |    +--- com.google.protobuf:protobuf-java:2.6.1
  |         |    +--- com.google.inject:guice:4.1.0
  |         |    |    +--- javax.inject:javax.inject:1
  |         |    |    \--- com.google.guava:guava:19.0
  |         |    +--- org.bouncycastle:bcprov-jdk16:1.46
  |         |    +--- com.google.guava:guava:19.0
  |         |    +--- com.drewnoakes:metadata-extractor:2.9.1
  |         |    |    \--- com.adobe.xmp:xmpcore:5.1.2
  |         |    +--- com.mixpanel:mixpanel-java:1.4.4
  |         |    |    \--- org.json:json:20090211
  |         |    \--- com.mortennobel:java-image-scaling:0.8.6
  |         |         \--- com.jhlabs:filters:2.0.235
  |         +--- project :PackJPGInterFileCompression
  |         |    +--- project :ProjectFive (*)
  |         |    \--- com.project:PackJPG:1.5
  |         +--- com.h2database:h2:1.3.176
  |         +--- com.google.code.gson:gson:2.7
  |         +--- org.json:json:20080701 -&gt; 20090211
  |         \--- itadaki:jbzip2:0.9.1
  </code></pre>
  
  <p>And my gradle file:</p>
  
  <pre><code>implementation (project(':ProjectOne')) {
          exclude group: 'ProjectTwo'
  }
  </code></pre>
  
  <p>Even when I exclude ProjectTwo from ProjectOne, I still find it in the dependency tree on Line 3 somehow. What am I missing?</p>