我一直在使用jackson解析器进行字符串到json的转换,也用于将字符串json转换为对象。这在以前的项目中正常工作。它仍在我的工作区中。现在我已经创建了一个新项目并添加了必要的jar文件。我在尝试创建ObjectMapper对象时遇到了这个错误
ObjectMapper mapper = new ObjectMapper();
这是我的logcat:
11-19 22:03:21.106: E/AndroidRuntime(28585): FATAL EXCEPTION: Thread-2896
11-19 22:03:21.106: E/AndroidRuntime(28585): Process: DevCity.Valkyrie.Ca.CxPtl.Android, PID: 28585
11-19 22:03:21.106: E/AndroidRuntime(28585): java.lang.NoClassDefFoundError: Failed resolution of: Lcom/fasterxml/jackson/databind/ObjectMapper;
11-19 22:03:21.106: E/AndroidRuntime(28585): at DevCity.Valkyrie.Ca.CxPtl.Android.Helpers.JsonHelper.convertObjectToJsonString(JsonHelper.java:12)
11-19 22:03:21.106: E/AndroidRuntime(28585): at DevCity.Valkyrie.Ca.CxPtl.Android.Helpers.ApiHelper.send(ApiHelper.java:119)
11-19 22:03:21.106: E/AndroidRuntime(28585): at DevCity.Valkyrie.Ca.CxPtl.Android.Login.verifyCredentials(Login.java:178)
11-19 22:03:21.106: E/AndroidRuntime(28585): at DevCity.Valkyrie.Ca.CxPtl.Android.Login$1.run(Login.java:136)
11-19 22:03:21.106: E/AndroidRuntime(28585): at java.lang.Thread.run(Thread.java:818)
11-19 22:03:21.106: E/AndroidRuntime(28585): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.fasterxml.jackson.databind.ObjectMapper" on path: DexPathList[[zip file "/data/app/DevCity.Valkyrie.Ca.CxPtl.Android-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
11-19 22:03:21.106: E/AndroidRuntime(28585): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
11-19 22:03:21.106: E/AndroidRuntime(28585): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
11-19 22:03:21.106: E/AndroidRuntime(28585): at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
11-19 22:03:21.106: E/AndroidRuntime(28585): ... 5 more
11-19 22:03:21.106: E/AndroidRuntime(28585): Suppressed: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
11-19 22:03:21.106: E/AndroidRuntime(28585): at java.lang.Class.classForName(Native Method)
11-19 22:03:21.106: E/AndroidRuntime(28585): at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
11-19 22:03:21.106: E/AndroidRuntime(28585): at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
11-19 22:03:21.106: E/AndroidRuntime(28585): at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
11-19 22:03:21.106: E/AndroidRuntime(28585): ... 6 more
11-19 22:03:21.106: E/AndroidRuntime(28585): Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
11-19 22:03:21.258: I/Timeline(28585): Timeline: Activity_idle id: android.os.BinderProxy@42725d9 time:30155856
11-19 22:03:21.631: E/WindowManager(28585): android.view.WindowLeaked: Activity DevCity.Valkyrie.Ca.CxPtl.Android.Login has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{2772d509 V.E..... R......D 0,0-578,345} that was originally added here
11-19 22:03:21.631: E/WindowManager(28585): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:367)
11-19 22:03:21.631: E/WindowManager(28585): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:271)
11-19 22:03:21.631: E/WindowManager(28585): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
11-19 22:03:21.631: E/WindowManager(28585): at android.app.Dialog.show(Dialog.java:306)
11-19 22:03:21.631: E/WindowManager(28585): at DevCity.Valkyrie.Ca.CxPtl.Android.Login.processCredentials(Login.java:129)
11-19 22:03:21.631: E/WindowManager(28585): at DevCity.Valkyrie.Ca.CxPtl.Android.Login.verifyFields(Login.java:116)
11-19 22:03:21.631: E/WindowManager(28585): at DevCity.Valkyrie.Ca.CxPtl.Android.Login.logMeIn(Login.java:86)
11-19 22:03:21.631: E/WindowManager(28585): at java.lang.reflect.Method.invoke(Native Method)
11-19 22:03:21.631: E/WindowManager(28585): at java.lang.reflect.Method.invoke(Method.java:372)
11-19 22:03:21.631: E/WindowManager(28585): at android.view.View$1.onClick(View.java:4091)
11-19 22:03:21.631: E/WindowManager(28585): at android.view.View.performClick(View.java:4856)
11-19 22:03:21.631: E/WindowManager(28585): at android.view.View$PerformClick.run(View.java:19956)
11-19 22:03:21.631: E/WindowManager(28585): at android.os.Handler.handleCallback(Handler.java:739)
11-19 22:03:21.631: E/WindowManager(28585): at android.os.Handler.dispatchMessage(Handler.java:95)
11-19 22:03:21.631: E/WindowManager(28585): at android.os.Looper.loop(Looper.java:211)
11-19 22:03:21.631: E/WindowManager(28585): at android.app.ActivityThread.main(ActivityThread.java:5373)
11-19 22:03:21.631: E/WindowManager(28585): at java.lang.reflect.Method.invoke(Native Method)
11-19 22:03:21.631: E/WindowManager(28585): at java.lang.reflect.Method.invoke(Method.java:372)
11-19 22:03:21.631: E/WindowManager(28585): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1020)
11-19 22:03:21.631: E/WindowManager(28585): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
我真的不是为什么。这是在一个不同的项目。
这是我的包浏览器的屏幕截图供参考
任何帮助将不胜感激。谢谢!
答案 0 :(得分:0)
对于那些有兴趣寻找这种情况答案的人。始终确保核心,数据绑定和注释具有相同的版本。将它们更新为更新的版本也会有所帮助。