gpt4 book ai didi

java - AndroidAnnotations Rest SourceHttpMessageConverter错误

转载 作者:行者123 更新时间:2023-12-01 11:40:36 26 4
gpt4 key购买 nike

我正在尝试使用 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.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

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

关于java - AndroidAnnotations Rest SourceHttpMessageConverter错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29556560/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com