title: Gradle dependency exclusion not working
body: <p>My project <code>build.gradle</code> dependencies are:</p>
  
  <pre><code>dependencies {
      ...
      compile 'com.google.code.gson:gson:2.3.1'
      compile 'com.google.android.gms:play-services-maps:8.4.0'
      compile 'com.google.android.gms:play-services-analytics:8.4.0'
      compile 'com.google.android.gms:play-services-appinvite:8.4.0'
      compile 'com.google.android.gms:play-services-gcm:8.4.0'
  
      compile 'co.realtime:messaging-android:2.1.58'
  }
  </code></pre>
  
  <p>And the <strong>co.realtime:messageing-android</strong> <a href="https://github.com/realtime-framework/RealtimeMessaging-Android/blob/2.1.58/library/build.gradle" rel="nofollow">build.gradle</a> dependencies are:</p>
  
  <pre><code>dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      compile ('com.android.support:appcompat-v7:21.0.3'){
          transitive = true;
      }
      compile ('com.google.android.gms:play-services:6.1.71'){
          transitive = true;
      }
      compile ('com.googlecode.json-simple:json-simple:1.1'){
          transitive = true;
      }
  }
  </code></pre>
  
  <p>If I try to compile my project I get the following error:</p>
  
  <blockquote>
    <p>Error:Gradle: Execution failed for task
    ':app-module:processProdDebugResources'.
    Error: more than one library with package name 'com.google.android.gms'   You can temporarily disable this error with
    android.enforceUniquePackageName=false   However, this is temporary
    and will be enforced in 1.0</p>
  </blockquote>
  
  <p>If I use <code>enforceUniquePackageName(false)</code> I get: </p>
  
  <blockquote>
    <p>cannot resolve symbol to <code>GoogleCloudMessaging.INSTANCE_ID_SCOPE</code></p>
  </blockquote>
  
  <p>So I guess I'll have to solve this by managing the dependencies. I've tried:</p>
  
  <pre><code>compile ('co.realtime:messaging-android:2.1.58'){
          exclude module: 'com.google'
  }
  
  compile ('co.realtime:messaging-android:2.1.58'){
          exclude group: 'com.google.android.gms', module: 'play-services-gcm'
  }
  </code></pre>
  
  <p>But nothing seams to work... How can I solve this?<br>
  Thanks.</p>