gpt4 book ai didi

android - jackson /JSON : ExceptionInInitializerError upon calling new ObjectMapper()

转载 作者:行者123 更新时间:2023-11-29 15:26:28 24 4
gpt4 key购买 nike

我在我的 Android 应用程序中使用 Jackson。我有一个用于传入调用的​​ BroadcastReceiver,它保存有关整个调用的信息,然后我将其保存到 JSON 数组中的 JSON 对象。

然后,我得到下面的异常,它指向我调用 ObjectMapper mapper = new ObjectMapper() 的行。我不知道该怎么做,因为我没有编写这些类(class)。帮忙?

09-04 09:08:58.220: E/AndroidRuntime(4445): FATAL EXCEPTION: main
09-04 09:08:58.220: E/AndroidRuntime(4445): java.lang.ExceptionInInitializerError
09-04 09:08:58.220: E/AndroidRuntime(4445): at com.ourcompany.appname.IncomingCallDetector.saveLog(IncomingCallDetector.java:80)
09-04 09:08:58.220: E/AndroidRuntime(4445): at com.ourcompany.appname.IncomingCallDetector.onReceive(IncomingCallDetector.java:70)
09-04 09:08:58.220: E/AndroidRuntime(4445): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2816)
09-04 09:08:58.220: E/AndroidRuntime(4445): at android.app.ActivityThread.access$3200(ActivityThread.java:126)
09-04 09:08:58.220: E/AndroidRuntime(4445): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2088)
09-04 09:08:58.220: E/AndroidRuntime(4445): at android.os.Handler.dispatchMessage(Handler.java:99)
09-04 09:08:58.220: E/AndroidRuntime(4445): at android.os.Looper.loop(Looper.java:123)
09-04 09:08:58.220: E/AndroidRuntime(4445): at android.app.ActivityThread.main(ActivityThread.java:4633)
09-04 09:08:58.220: E/AndroidRuntime(4445): at java.lang.reflect.Method.invokeNative(Native Method)
09-04 09:08:58.220: E/AndroidRuntime(4445): at java.lang.reflect.Method.invoke(Method.java:521)
09-04 09:08:58.220: E/AndroidRuntime(4445): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
09-04 09:08:58.220: E/AndroidRuntime(4445): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
09-04 09:08:58.220: E/AndroidRuntime(4445): at dalvik.system.NativeStart.main(Native Method)
09-04 09:08:58.220: E/AndroidRuntime(4445): Caused by: java.lang.ExceptionInInitializerError
09-04 09:08:58.220: E/AndroidRuntime(4445): at com.fasterxml.jackson.databind.ObjectMapper.<clinit>(ObjectMapper.java:197)
09-04 09:08:58.220: E/AndroidRuntime(4445): ... 13 more
09-04 09:08:58.220: E/AndroidRuntime(4445): Caused by: java.lang.NoClassDefFoundError: com.fasterxml.jackson.annotation.JsonAutoDetect
09-04 09:08:58.220: E/AndroidRuntime(4445): at com.fasterxml.jackson.databind.introspect.VisibilityChecker$Std.<clinit>(VisibilityChecker.java:169)
09-04 09:08:58.220: E/AndroidRuntime(4445): ... 14 more

我的广播接收器在这里:http://pastie.org/4661134

最佳答案

似乎发生的情况是 JsonAutoDetect 未添加到您的项目中。确保它包含在 apk 中(如果您使用的是 eclipse,请参阅 eclipse 中的类路径部分)

关于android - jackson /JSON : ExceptionInInitializerError upon calling new ObjectMapper(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12260504/

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