本文介绍了AndroidAnnotations休息SourceHttpMessageConverter错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图用AndroidAnnotations的RESTClient实现,但是当我打电话的客户,我得到以下错误的方法之一:
I'm trying to use the RestClient of AndroidAnnotations but when I call one of the methods in the client I get the following error:
04-10 10:07:23.624 7528-7528/eu.shareforce.vitens E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.VerifyError: org/springframework/http/converter/xml/SourceHttpMessageConverter
at org.springframework.web.client.RestTemplate.<init>(RestTemplate.java:149)
at eu.shareforce.vitens.Interfaces.VitensRestClient_.<init>(VitensRestClient_.java:23)
at eu.shareforce.vitens.Activities.LoginActivity_.init_(LoginActivity_.java:42)
at eu.shareforce.vitens.Activities.LoginActivity_.onCreate(LoginActivity_.java:34)
at android.app.Activity.performCreate(Activity.java:5165)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1103)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2419)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2520)
at android.app.ActivityThread.access$600(ActivityThread.java:162)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1366)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:5751)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1083)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:850)
at dalvik.system.NativeStart.main(Native Method)
该RestClient.java
The RestClient.java
@Rest(rootUrl = "http://meer-likes.nl/api/?call=", converters = {
MappingJackson2HttpMessageConverter.class,
StringHttpMessageConverter.class })
public interface RestClient {
@Get("/user/forgot-password/{email}")
String forgotPassword(String email);
}
}
活动:
@EActivity(R.layout.activity_forgotpassword)
public class ForgotPassword extends Activity {
@RestService
VitensRestClient client;
@ViewById
Button forgotButton;
@ViewById
EditText email_address;
@Click
void forgotButton() {
forgotPassword();
}
@Background
void forgotPassword() {
client.forgotPassword(email_address.getText().toString());
}
}
我使用的Android 1.0.1工作室,AndroidAnnotations 3.2和4.1.6 springframework的
I am using Android Studio 1.0.1, AndroidAnnotations 3.2 and SpringFramework 4.1.6.
推荐答案
找到了解决办法!我不得不使用不同的Spring的依赖。
我要使用:
Found a solution! I had to use different Spring dependencies.I have to use:
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
而不是:
compile 'org.springframework:spring-context:4.1.6.RELEASE'
compile ('org.springframework:spring-web:4.1.6.RELEASE') {
exclude group: 'commons-logging', module: 'commons-logging'
}
这篇关于AndroidAnnotations休息SourceHttpMessageConverter错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!