Spring-Android Issue integrating RestTemplate
Join the DZone community and get the full member experience.Join For Free
I started working on some REST client Android development. I have spent the past 1-2 month reading books, and just looking around the internet for good resources, so I could feel I had a complete picture as to what my current skills could best be used to develop.
I started using the Spring Tool Set (STS) to develop my android app. That worked ok, but I have been a long time Intellij developer. Now with the release of IDEA X (ideaIU-98.520), there is android support.
Now there are plenty of books out there to learn Android, and I can tell you, none of them worked for me as a single source to give me the picture I needed to get business apps working.
BOOKS I read:
- Android Application Development 
- Beginning Android 2 
- Hello_Android_3rd_Edition 
- Pro Android 2 
- Professional Android 2 Application Development 
- Unlocking Android  (partial)
Getting the basics to say hello world was easy, but when you want to move past that, you really need to dig (imho).
What I really wanted to do, is integrate Spring-Mobile, and the RestTemplate into my android all so I can leverage the Springframework tools.
I found http://www.springsource.org/spring-mobile which actually is a server side framework for detecting Browser verse mobile devices. So don’t let the name fool you.
I then found http://static.springsource.org/spring-android/docs/1.0.x/reference/htmlsingle/ which is actually a client side library that helps connect to REST based services.
The Spring Android documentation says to get the following libraries:
I was very confused, as I cannot find any Spring example where using IDEA, or Eclipse, that Maven is used for Rapid Development. I spent several hours trying to find a working solution, and could not find this documented anywhere. Frustrating! Finally I downloaded the 3 jars, then added them to my ./lib directory and added all 3 Libraries to my Third-Party Jars in my IDEA project.
As soon as I built the application, I get this exception:
java.lang.IllegalArgumentException: already added: Lorg/apache/commons/logging/Log;
This led me to see that for some reason, spring-android-commons-logging-1.0.1.BUILD-20101129.090047-10.jar was not going to work. I removed that jar, and the error went away, and I was able to get the example to work.
Opinions expressed by DZone contributors are their own.