title: Spring Android Rest Template with Maven and Android 3.0 or highest
body: <p>After a couple of months working with Android and I have a problem. I have a project with Maven and Spring-Android rest using template. The project works correctly with Android versions prior to 3.0. I searched for solutions or examples and have not gotten it to work. I would like to know if a failure of my pom.xml configuration, dependencies old ... I would appreciate the help. I currently use the following pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
  &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  &lt;groupId&gt;com.blablabla&lt;/groupId&gt;
  &lt;artifactId&gt;BlaBLa&lt;/artifactId&gt;
  &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  &lt;packaging&gt;apk&lt;/packaging&gt;
  &lt;name&gt;BlaBla&lt;/name&gt;
  
  &lt;properties&gt; 
      &lt;android-platform&gt;12&lt;/android-platform&gt;
      &lt;android-emulator&gt;12&lt;/android-emulator&gt;
      &lt;maven-android-plugin-version&gt;2.8.4&lt;/maven-android-plugin-version&gt;
      &lt;maven-compiler-plugin-version&gt;2.3.2&lt;/maven-compiler-plugin-version&gt;
      &lt;maven-eclipse-plugin-version&gt;2.8&lt;/maven-eclipse-plugin-version&gt;
      &lt;android-version&gt;3.1_r3&lt;/android-version&gt;
  
      &lt;java-version&gt;1.6&lt;/java-version&gt;
      &lt;spring-android-version&gt;1.0.0.M4&lt;/spring-android-version&gt;
      &lt;spring-social-version&gt;1.0.0.RC1&lt;/spring-social-version&gt;
      &lt;jackson-version&gt;1.8.3&lt;/jackson-version&gt;
      &lt;gson-version&gt;1.7.1&lt;/gson-version&gt;
      &lt;simple-version&gt;2.6&lt;/simple-version&gt;
  &lt;/properties&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.android&lt;/groupId&gt;
          &lt;artifactId&gt;android&lt;/artifactId&gt;
          &lt;version&gt;${android-version}&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.android&lt;/groupId&gt;
          &lt;artifactId&gt;spring-android-rest-template&lt;/artifactId&gt;
          &lt;version&gt;${spring-android-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.android&lt;/groupId&gt;
          &lt;artifactId&gt;spring-android-auth&lt;/artifactId&gt;
          &lt;version&gt;${spring-android-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
          &lt;artifactId&gt;spring-security-crypto&lt;/artifactId&gt;
          &lt;version&gt;3.1.0.RC2.crypto&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;!-- Exclude in favor of Spring Android Core --&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.social&lt;/groupId&gt;
          &lt;artifactId&gt;spring-social-core&lt;/artifactId&gt;
          &lt;version&gt;${spring-social-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;!-- Exclude in favor of Spring Android RestTemplate --&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;spring-web&lt;/artifactId&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;!-- Provided by Android --&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.social&lt;/groupId&gt;
          &lt;artifactId&gt;spring-social-twitter&lt;/artifactId&gt;
          &lt;version&gt;${spring-social-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;!-- Provided by Android --&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.social&lt;/groupId&gt;
          &lt;artifactId&gt;spring-social-facebook&lt;/artifactId&gt;
          &lt;version&gt;${spring-social-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;!-- Provided by Android --&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
                  &lt;groupId&gt;commons-logging&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;!-- Using Jackson for JSON marshaling --&gt;
          &lt;groupId&gt;org.codehaus.jackson&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-mapper-asl&lt;/artifactId&gt;
          &lt;version&gt;${jackson-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;!-- Using Gson for JSON marshaling --&gt;
          &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
          &lt;artifactId&gt;gson&lt;/artifactId&gt;
          &lt;version&gt;${gson-version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;!-- Using Simple for XML marshaling --&gt;
          &lt;groupId&gt;org.simpleframework&lt;/groupId&gt;
          &lt;artifactId&gt;simple-xml&lt;/artifactId&gt;
          &lt;version&gt;${simple-version}&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;!-- StAX is not available on Android --&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;stax&lt;/artifactId&gt;
                  &lt;groupId&gt;stax&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;stax-api&lt;/artifactId&gt;
                  &lt;groupId&gt;stax&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;!-- Provided by Android --&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;xpp3&lt;/artifactId&gt;
                  &lt;groupId&gt;xpp3&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  &lt;build&gt;
      &lt;finalName&gt;${project.artifactId}&lt;/finalName&gt;
      &lt;sourceDirectory&gt;src&lt;/sourceDirectory&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;com.jayway.maven.plugins.android.generation2&lt;/groupId&gt;
              &lt;artifactId&gt;maven-android-plugin&lt;/artifactId&gt;
              &lt;version&gt;${maven-android-plugin-version}&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;sdk&gt;
                      &lt;platform&gt;${android-platform}&lt;/platform&gt;
                  &lt;/sdk&gt;
                  &lt;emulator&gt;
                      &lt;avd&gt;${android-emulator}&lt;/avd&gt;
                  &lt;/emulator&gt;
                  &lt;deleteConflictingFiles&gt;true&lt;/deleteConflictingFiles&gt;
                  &lt;undeployBeforeDeploy&gt;true&lt;/undeployBeforeDeploy&gt;
              &lt;/configuration&gt;
              &lt;extensions&gt;true&lt;/extensions&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;version&gt;${maven-compiler-plugin-version}&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;source&gt;${java-version}&lt;/source&gt;
                  &lt;target&gt;${java-version}&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-eclipse-plugin&lt;/artifactId&gt;
              &lt;version&gt;${maven-eclipse-plugin-version}&lt;/version&gt;
              &lt;configuration&gt;
                  &lt;downloadSources&gt;true&lt;/downloadSources&gt;
                  &lt;downloadJavadocs&gt;true&lt;/downloadJavadocs&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  
  &lt;repositories&gt;
      &lt;!-- For testing against latest Spring snapshots --&gt;
      &lt;repository&gt;
          &lt;id&gt;org.springframework.maven.snapshot&lt;/id&gt;
          &lt;name&gt;Spring Maven Snapshot Repository&lt;/name&gt;
          &lt;url&gt;http://maven.springframework.org/snapshot&lt;/url&gt;
          &lt;releases&gt;&lt;enabled&gt;false&lt;/enabled&gt;&lt;/releases&gt;
          &lt;snapshots&gt;&lt;enabled&gt;true&lt;/enabled&gt;&lt;/snapshots&gt;
      &lt;/repository&gt;
      &lt;!-- For developing against latest Spring milestones --&gt;
      &lt;repository&gt;
          &lt;id&gt;org.springframework.maven.milestone&lt;/id&gt;
          &lt;name&gt;Spring Maven Milestone Repository&lt;/name&gt;
          &lt;url&gt;http://maven.springframework.org/milestone&lt;/url&gt;
          &lt;snapshots&gt;&lt;enabled&gt;false&lt;/enabled&gt;&lt;/snapshots&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  </code></pre>
  
  <p></p>
  
  <p>I found another example in this link but I could not make it work:
  <a href="https://github.com/SpringSource/spring-android-samples/blob/master/spring-android-showcase/client/pom.xml" rel="nofollow">https://github.com/SpringSource/spring-android-samples/blob/master/spring-android-showcase/client/pom.xml</a></p>
  
  <p>The call to rest in the code is a basic example:</p>
  
  <pre><code>RestTemplate restTemplate = new RestTemplate();
      String url = "https://ajax.googleapis.com/ajax/services/search/web?v=1.0&amp;q={query}";
      String result = restTemplate.getForObject(url, String.class, "whatever");
  </code></pre>
  
  <p>Thank you.</p>