AndroidAnnotations Rest SourceHttpMessageConverter 错误

AndroidAnnotations Rest SourceHttpMessageConverter error

我正在尝试使用 AndroidAnnotations 的 RestClient,但是当我调用客户端中的一种方法时,出现以下错误:

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.access0(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

@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);
    }
}

Activity:

@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 Studio 1.0.1、AndroidAnnotations 3.2 和 SpringFramework 4.1.6。

找到解决办法了!我不得不使用不同的 Spring 依赖项。 我必须使用:

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'
}