title: Android Gradle exclude classes for Debug BuildType
body: <p><strong>Bakground</strong></p>
  
  <p>I am using Google Play Services in my project for various reasons. Google Play Services are a big dependancy which is drastically increases my build time. So I would like to disable Google Play Services for my "Debug" version , so I could compile my project faster.</p>
  
  <p><strong>What I do ?</strong> </p>
  
  <p>To exclude Google Play Services during my debug builds , I just do the conditional compilation like this :</p>
  
  <pre><code>releaseCompile 'com.google.android.gms:play-services-plus:7.5.+'
  releaseCompile 'com.google.android.gms:play-services-ads:7.5.+'
  releaseCompile 'com.google.android.gms:play-services-gcm:7.5.+'
  </code></pre>
  
  <p>So Google Play Services are being compiled only for release builds , and not included in Debug builds.So far so good.</p>
  
  <p><strong>A pitfall</strong></p>
  
  <p>There are some classes in my code that are dependent on Google Play Services.I can easily abstract them with interfaces , and load stubs instead.But the problem is , those classes are still being compiled during my "Debug" build even though I am not referencing them directly (in fact I am loading them using reflection).</p>
  
  <p><strong>Workaround</strong></p>
  
  <p>To ignore compilation errors for classes I am not using ,I just exclude them from source sets in debug build type like this :</p>
  
  <pre><code>   debug {
          minifyEnabled false
          sourceSets {
              main {
                  java {
                      exclude '**/tracking/impl/**'
                      exclude '**/GoogleApiClientWrapper.java'
                  }
              }
          }
      }
  </code></pre>
  
  <p>And the problem is solved , I am able to compile by "Debug" version without Google play services and the build time is faster.</p>
  
  <p><strong>The problem</strong></p>
  
  <p>Even though I am specifying the <em>sourceSets</em> block only in the "Debug" build type , I have noticed that those classes are stripped anyway even in release build Types. Why ? How can I exclude those classes <strong>ONLY</strong> for Debug build type ?</p>
  
  <p><strong>NOTE</strong></p>
  
  <ul>
  <li>Already configured proguard-rules to not strip those classes (since I am using reflection)</li>
  <li>Disabled proguard for release build</li>
  <li>Tried to define source sets in different places (even in flavors) , it looks like the latest sourceSet defined overrides all the previous.</li>
  </ul>