Android NFC示例 - java.lang.ExceptionInInitializerError

时间:2012-08-05 00:05:14

标签: java android nfc noclassdeffounderror

我正在尝试运行我的eclipse下载附带的一个示例应用程序,特别是NFC示例应用程序。所以我加载它并运行它但它一直崩溃,出现以下错误。

这是代码本身的链接 http://source-android.frandroid.com/development/samples/NFCDemo/src/com/example/android/nfc/

08-04 23:49:40.056: D/dalvikvm(409): VFY: replacing opcode 0x71 at 0x0003
08-04 23:49:40.056: D/dalvikvm(409): VFY: dead code 0x0006-000b in Lcom/example/android/nfc/record/UriRecord;.<init> (Landroid/net/Uri;)V
08-04 23:49:40.066: I/dalvikvm(409): Could not find method com.google.common.base.Preconditions.checkArgument, referenced from method com.example.android.nfc.record.UriRecord.parseWellKnown
08-04 23:49:40.066: W/dalvikvm(409): VFY: unable to resolve static method 101: Lcom/google/common/base/Preconditions;.checkArgument (Z)V
08-04 23:49:40.066: D/dalvikvm(409): VFY: replacing opcode 0x71 at 0x000c
08-04 23:49:40.066: D/dalvikvm(409): VFY: dead code 0x000f-004f in Lcom/example/android/nfc/record/UriRecord;.parseWellKnown (Landroid/nfc/NdefRecord;)Lcom/example/android/nfc/record/UriRecord;
08-04 23:49:40.066: W/dalvikvm(409): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/example/android/nfc/record/UriRecord;
08-04 23:49:40.066: D/AndroidRuntime(409): Shutting down VM
08-04 23:49:40.076: W/dalvikvm(409): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-04 23:49:40.086: E/AndroidRuntime(409): FATAL EXCEPTION: main
08-04 23:49:40.086: E/AndroidRuntime(409): java.lang.ExceptionInInitializerError
08-04 23:49:40.086: E/AndroidRuntime(409):  at com.example.android.nfc.NdefMessageParser.getRecords(NdefMessageParser.java:47)
08-04 23:49:40.086: E/AndroidRuntime(409):  at com.example.android.nfc.NdefMessageParser.parse(NdefMessageParser.java:41)
08-04 23:49:40.086: E/AndroidRuntime(409):  at com.example.android.nfc.TagViewer.buildTagViews(TagViewer.java:105)
08-04 23:49:40.086: E/AndroidRuntime(409):  at com.example.android.nfc.TagViewer.resolveIntent(TagViewer.java:86)
08-04 23:49:40.086: E/AndroidRuntime(409):  at com.example.android.nfc.TagViewer.onCreate(TagViewer.java:59)
08-04 23:49:40.086: E/AndroidRuntime(409):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-04 23:49:40.086: E/AndroidRuntime(409):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
08-04 23:49:40.086: E/AndroidRuntime(409):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
08-04 23:49:40.086: E/AndroidRuntime(409):  at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-04 23:49:40.086: E/AndroidRuntime(409):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
08-04 23:49:40.086: E/AndroidRuntime(409):  at android.os.Handler.dispatchMessage(Handler.java:99)
08-04 23:49:40.086: E/AndroidRuntime(409):  at android.os.Looper.loop(Looper.java:123)
08-04 23:49:40.086: E/AndroidRuntime(409):  at android.app.ActivityThread.main(ActivityThread.java:3683)
08-04 23:49:40.086: E/AndroidRuntime(409):  at java.lang.reflect.Method.invokeNative(Native Method)
08-04 23:49:40.086: E/AndroidRuntime(409):  at java.lang.reflect.Method.invoke(Method.java:507)
08-04 23:49:40.086: E/AndroidRuntime(409):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-04 23:49:40.086: E/AndroidRuntime(409):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-04 23:49:40.086: E/AndroidRuntime(409):  at dalvik.system.NativeStart.main(Native Method)
08-04 23:49:40.086: E/AndroidRuntime(409): Caused by: java.lang.NoClassDefFoundError: com.google.common.collect.ImmutableBiMap
08-04 23:49:40.086: E/AndroidRuntime(409):  at com.example.android.nfc.record.UriRecord.<clinit>(UriRecord.java:51)
08-04 23:49:40.086: E/AndroidRuntime(409):  ... 18 more

我是Java新手,甚至更新Android,不知道如何调试Android应用程序。我尝试在代码中添加断点但是没有触发。所以我很感激能从这里得到的任何帮助。

1 个答案:

答案 0 :(得分:0)

经过几次尝试,它对我有用。不知道我最终做了什么才能得到它,但这有效,但我重新加载,然后再次尝试和繁荣。

NoClassDefFoundError when GoogleAnalyticsTracker.getInstance()