With nearly two decades of experience working in the IT industry in various roles as Enterprise technology consultant, Java Architect, project leader, Engineer, Designer and Developer, Mr. Knutson has gained a wide variety of experience in disciplines including JavaEE, Web Services, Mobile Computing and Enterprise Integration Solutions. Over the course of his career, Mr. Knutson has enjoyed long lasting partnerships with many of the most recognizable names in the Health Care, Financial, Banking, Insurance, Manufacturing, Telecommunications, Utilities, Product Distribution, Industrial and Electronics industries employing industry standard full software life cycle methodologies including the Rational Unified Process (RUP), Agile, SCRUM, and Extreme Programming (XP). Mr. Knutson has also undertaken speaking engagements, training seminars, white paper and book publishing engagements world-wide. As an active Blogger and tweeter, Mr. Knutson has also been inducted in the prestigious DZone.com Most Valuable Blogger (MVB) group and can be followed at http://www.dzone.com/page/mvbs and twitter at http://twitter.com/mickknutson. Able to quickly and effectively adapt to any phase of an existing project from Business Modeling to Production Support, Mr. Knutson’s wide array of technical expertise in OOA / OOD / OOP, Java, J2EE, Internet, Oracle, Enterprise Integration and Message Oriented Middleware allow him to seamlessly integrate into your Information Systems project at any phase and provide immediate productivity. Mr. Knutson is exceptional at team building and motivating either at a peer-to-peer level, or in a leadership role with excellent communications skills and the ability to adapt to all environments and cultures with ease. Mick is a DZone MVB and is not an employee of DZone and has posted 18 posts at DZone. You can read more from them at their website. View Full User Profile

Spring-Android Issue integrating RestTemplate

12.06.2010
| 5885 views |
  • submit to reddit

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 [2009]
  • Beginning Android 2 [2010]
  • Hello_Android_3rd_Edition [2010]
  • Pro Android 2 [2010]
  • Professional Android 2 Application Development [2010]
  • Unlocking Android [2009] (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:

spring-android-commons-logging-1.0.1.BUILD-20101129.090047-10.jar
spring-android-rest-template-1.0.1.BUILD-20101129.090103-10.jar
commons-httpclient-3.1.jar

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.

From http://www.baselogic.com/blog/development/spring-android-issue-integrating-resttemplate

Published at DZone with permission of Mick Knutson, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)