title: Adding Google API Java Client Library and Calendar API Java Library to Maven dependencies
body: <p>I have an Android project using Google Calendar v3 API.</p>
  
  <p>I'm using <a href="http://code.google.com/p/google-api-java-client/" rel="nofollow">Google API Client</a>  and <a href="http://code.google.com/p/google-api-java-client/wiki/APIs#Calendar_API" rel="nofollow">Calendar API Java</a> Libraries to perform queries on Google Calendar.</p>
  
  <p>I have problems setting up maven dependencies. I've added those libraries to my pom.xml using ids from documentation, but some of them were outdated, so I've ended up with this <a href="http://pastebin.com/a0DxCs22" rel="nofollow">pom.xml</a> </p>
  
  <p>I had to put <code>&lt;scope&gt;provided&lt;/scope&gt;</code> to google-api-client, google-http-client-jackson and google-http-client-android libraries because maven was failing when trying to dex those libs.</p>
  
  <pre><code>Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.4.1:dex (default-dex)
  </code></pre>
  
  <p>Now this pom.xml successfully creates .apk and installs it on device. But when I trying to make queries to Calendar API using provided libraries, an app fails, saying that it cannot find some classes.</p>
  
  <pre><code>12-19 17:32:17.247: E/dalvikvm(15119): Could not find class 'com.google.api.services.calendar.model.TimePeriod', referenced from method 
  </code></pre>
  
  <p>When I'm building an app from Eclipse (all .jars are in the /libs folder) everything is ok.</p>
  
  <p>So I wonder if there is a correct way to add those dependencies to Maven script. 
  Google has a lot of an outdated documentation with non-working links or samples.
  Otherwise I'd have to get rid of Google libraries and write Calendar API queries by myself.</p>
  
  <p>Any help will be highly appreciated.</p>
  
  <p><strong>ANSWER:</strong></p>
  
  <p>xpp3.jar was causing the problem because it has classes from javax package. I had to manually exclude it from all Google libraries:</p>
  
  <pre><code>            &lt;exclusion&gt;
                    &lt;artifactId&gt;xpp3&lt;/artifactId&gt;
                    &lt;groupId&gt;xpp3&lt;/groupId&gt;
              &lt;/exclusion&gt;
  </code></pre>