1

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

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

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

4

1 回答 1

5

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

于 2012-09-04T09:30:21.753 回答