Android Talker(3)Go on with the REST Sample with Real Device

本文探讨了在使用Android开发时遇到的Maven依赖冲突问题,并提供了解决方案。同时,介绍了如何将Spring MVC应用与Groovy控制器结合使用,以增强项目的灵活性和功能。通过调整Maven配置和引入特定的Groovy转换器,开发者能够有效解决HTTP响应类型不匹配的问题,实现更高效的请求处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android Talker(3)Go on with the REST Sample with Real Device


Eclipse Error Message:
Errors occurred during the build.

Errors running builder 'Maven Project Builder' on product 'xxxxx'.

java.lang.NullPointerException


Solution:
I do not know why there are 2 maven dependency plugins in my STS, so I try to remove the project configuration.

Click the project and choose:

Maven ----> Disable Maven Dependencies

Maven ----> Disable Maven Nature


After remove 2 maven dependencies, and then add the first maven dependency back.


And we need to make sure we add android path to our eclipse:

Run Configuration -----> Envrionment ---->

ANDROID_HOME /opt/android-sdk

SDK_ROOT /opt/android-sdk/tools


I will go on to learn the projects spring-android-showcase-client, spring-android-showcase-server.


Error Message:
org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation


Solution:
Add these converter

<beanid="handlerAdapter"class="com.sillycat.easygroovyplugin.servlet.proxy.ProxyAwareAnnotationMethodHandlerAdapter"]]>
<propertyname="messageConverters"]]>
<list]]>
<refbean="jsonConverter"/>
</list]]>
</property]]>
</bean]]>


<beanid="jsonConverter"
class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"]]>
<propertyname="supportedMediaTypes"value="application/json"/>
</bean]]>


I changed my easyrestserver side to use groovy controller, velocity for view.


I changed my EasyRestClientAndroid working with both get all persons and get one person.


I am using maven on my eclipse, so my command will be

>clean install android:deploy android:run


references:
http://developer.android.com/training/index.html

http://www.mkyong.com/spring-mvc/spring-3-mvc-contentnegotiatingviewresolver-example/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值