gpt4 book ai didi

java - 安卓 REST - java.lang.VerifyError : MappingJacksonHttpMessageConverter

转载 作者:行者123 更新时间:2023-11-30 03:19:32 27 4
gpt4 key购买 nike

我是这个论坛的新手,也是 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

最佳答案

使用权限检查这些AsyncTaskmanifest文件的问题,或者:

  1. 检查您的resource xmldrawable 等是否正确配置以获得输出,..

  2. 我也遇到了同样的错误,我使用了 lib 文件 并且上面的过程消失了,..

  3. 同时检查您的 HTTPHTTPS

关于java - 安卓 REST - java.lang.VerifyError : MappingJacksonHttpMessageConverter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19423248/

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