title: Firebase Cloud Messaging error: more than one library with package name 'com.google.android.gms'
body: <p>I have a project that uses Google Firebase Messaging. I followed the documentation and it worked like a charm. The problem is that to build it on the server, I need to add the .aar files manualy, so I checked the gradle dependency tree and added the needed dependencies as shown in the image:</p>
  
  <p>firebase-messaging dependencies
  <img src="https://i.stack.imgur.com/5Kitd.png" alt=""></p>
  
  <p>The problem is that when I try to compile, I get the following error:</p>
  
  <blockquote>
    <p>Error: more than one library with package name
    'com.google.android.gms'</p>
  </blockquote>
  
  <p>Error message:<br>
  <img src="https://i.stack.imgur.com/FSQTZ.png" alt=""></p>
  
  <p>I checked the other threads in stackoverflow about this error, but none of the solutions worked for me. Here are the dependencies in my gradle file:</p>
  
  <pre><code>dependencies {
      debugCompile project(path: ':OrbitEmailCore', configuration: 'debug')
      releaseCompile project(path: ':OrbitEmailCore', configuration: 'release')
      debugCompile project(path: ':OrbitInterOp', configuration: 'debug')
      releaseCompile project(path: ':OrbitInterOp', configuration: 'release')
      compile 'commons-io:commons-io:2.0.1'
      compile files('./libs/docviewer_v4.jar')
      compile 'com.android.support:cardview-v7:22.0.0'
      compile 'com.android.support:recyclerview-v7:22.0.0'
      testCompile 'junit:junit:4.12'
      testCompile 'org.powermock:powermock-module-junit4:1.6.4'
      testCompile 'org.powermock:powermock-mockito-release-full:1.6.4'
      testCompile 'org.powermock:powermock-api-mockito:1.6.4'
      compile project(':firebase-iid-9.8.0')
      compile project(':firebase-messaging-9.8.0')
      compile project(':firebase-common-9.8.0')
      compile project(':play-services-basement-9.8.0')
  }
  </code></pre>
  
  <p>I know that this problem usally appears when different versions of dependencies are used, but in my case I am using 9.8.0 for all of them. The problem is with play-service-basement dependency, but if I don't add it my code won't compile because some classes are missing.</p>
  
  <p>The strange thing is that the external libraries folder in my project contains libraries for firebase and play-services for both 9.0 and 9.8, even though I am not declaring them anywhere else in the project.</p>
  
  <p>Can anyone help?</p>