我是这个论坛的新手,也是Android的java开发人员。我正在尝试使用Spring设置REST连接到服务,但继续收到以下错误:
java.lang.VerifyError:org / springframework / http / converter / json / MappingJacksonHttpMessageConverter
这是我写的代码。有人可以帮帮我吗?
public ArrayList<Employee> getAllEmployees(){
ResponseEntity<EmployeeContainer> responseEntity = null;
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());
responseEntity = restTemplate.exchange(BASE_URL + "employee", HttpMethod.GET, getRequestEntity(), EmployeeContainer.class);
return responseEntity.getBody().getEmployees();
}
这是我的堆栈,我正在使用Android Studio 0.2
10-15 12:37:42.983 25836-25854/com.project.sandbox2 E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.VerifyError: org/springframework/http/converter/json/MappingJacksonHttpMessageConverter
at com.project.sandbox2.EmployeeService.getAllEmployees(EmployeeService.java:36)
at com.project.sandbox2.RestTask.doInBackground(RestTask.java:19)
at com.project.sandbox2.RestTask.doInBackground(RestTask.java:12)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:856)
10-15 12:37:43.143 304-524/system_process W/ActivityManager﹕ Force finishing activity com.project.sandbox2/.MainActivity
10-15 12:37:43.235 304-524/system_process W/WindowManager﹕ Failure taking screenshot for (328x583) to layer 21010
10-15 12:37:43.483 36-190/? E/SurfaceFlinger﹕ ro.sf.lcd_density must be defined as a build property
10-15 12:37:43.533 36-36/? E/SurfaceFlinger﹕ ro.sf.lcd_density must be defined as a build property
10-15 12:37:44.793 304-404/system_process E/ThrottleService﹕ problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
10-15 12:37:46.583 407-409/com.android.phone D/dalvikvm﹕ GC_CONCURRENT freed 385K, 18% free 2913K/3548K, paused 5ms+6ms, total 54ms
答案 0 :(得分:1)
使用AsyncTask
检查这些manifest
或permissions
文件的问题,或者:
检查您的resource
xml
,drawable
等是否配置正确以获得输出,..
我也遇到了同样的错误lib files
以及上面的过程已经消失了......
并检查您的HTTP
或HTTPS