问题描述
我试图让我的Android应用程序功能作为REST客户端。基本上,我跟着这个例子:https://github.com/SpringSource/spring-android-samples/tree/master/spring-android-basic-auth/client/src/org/springframework/android/basicauth 。
i'm trying to let my android application function as a REST Client. Basically i followed this example: https://github.com/SpringSource/spring-android-samples/tree/master/spring-android-basic-auth/client/src/org/springframework/android/basicauth .
我开发的Android 2.3及以上。我加了
I am developing for Android 2.3 and above. I added
spring-android-rest-template-1.0.0.RELEASE.jar
spring-android-auth-1.0.0.RELEASE.jar
spring-android-core-1.0.0.RELEASE.jar and
jackson-mini-1.9.11.jar
我的构建路径。
to my buildpath.
反正我总是得到这些错误
Anyway I always get these errors
11-26 19:01:24.461: E/dalvikvm(15994): Could not find class 'org.codehaus.jackson.map.ObjectMapper', referenced from method org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.<init>
11-26 19:01:24.480: E/AndroidRuntime(15994): java.lang.RuntimeException: An error occured while executing doInBackground()
11-26 19:01:24.480: E/AndroidRuntime(15994): Caused by: java.lang.NoClassDefFoundError: org.codehaus.jackson.map.ObjectMapper
在此code的第二行:
in the second line of this code:
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());
任何人可以帮助我在这里?
Can anybody help me out here?
光圈
推荐答案
这个问题的解决方案是(如Selvin在他的评论中所述)包括完整的杰克逊,而不是杰克逊的小型图书馆。
再次感谢Selvin。
The solution to the problem was (as Selvin stated in his comment) to include the full jackson instead of the jackson mini library.Thanks again Selvin.
这篇关于Android的春天杰克逊映射:NoClassDefFoundError的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!