2012-09-10 94 views
0

我希望能找出一些幫助,搞清楚這個異常消息到底對我說什麼。我能夠使用調試器將問題縮小到代碼中的特定行。不過,我想更多的信息能夠更好地找出代碼中的實際問題。爪哇日蝕解剖Java異常

public static List<ParsedNdefRecord> getRecords(NdefRecord[] records) 
    { 
     List<ParsedNdefRecord> elements = new ArrayList<ParsedNdefRecord>(); 
     for (NdefRecord record : records) { 
      if (UriRecord.isUri(record)) { 
       elements.add(UriRecord.parse(record)); 
      } else if (TextRecord.isText(record)) { 
       elements.add(TextRecord.parse(record)); 
      } else if (SmartPoster.isPoster(record)) { 
       elements.add(SmartPoster.parse(record)); 
      } 
     } 
     return elements; 
    } 



09-10 13:47:38.207: D/dalvikvm(332): VFY: replacing opcode 0x71 at 0x000c 
09-10 13:47:38.207: D/dalvikvm(332): VFY: dead code 0x000f-004f in Lcom/example/android/nfc/record/UriRecord;.parseWellKnown (Landroid/nfc/NdefRecord;)Lcom/example/android/nfc/record/UriRecord; 
09-10 13:47:49.617: W/dalvikvm(332): Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/example/android/nfc/record/UriRecord; 
09-10 13:48:28.971: D/AndroidRuntime(332): Shutting down VM 
09-10 13:48:28.971: W/dalvikvm(332): threadid=1: thread exiting with uncaught exception (group=0x40015560) 
09-10 13:48:29.178: E/AndroidRuntime(332): FATAL EXCEPTION: main 
09-10 13:48:29.178: E/AndroidRuntime(332): java.lang.ExceptionInInitializerError 
09-10 13:48:29.178: E/AndroidRuntime(332): at com.example.android.nfc.NdefMessageParser.getRecords(NdefMessageParser.java:48) 
09-10 13:48:29.178: E/AndroidRuntime(332): at com.example.android.nfc.NdefMessageParser.parse(NdefMessageParser.java:41) 
09-10 13:48:29.178: E/AndroidRuntime(332): at com.example.android.nfc.TagViewer.buildTagViews(TagViewer.java:105) 
09-10 13:48:29.178: E/AndroidRuntime(332): at com.example.android.nfc.TagViewer.resolveIntent(TagViewer.java:86) 
09-10 13:48:29.178: E/AndroidRuntime(332): at com.example.android.nfc.TagViewer.onCreate(TagViewer.java:59) 
09-10 13:48:29.178: E/AndroidRuntime(332): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 
09-10 13:48:29.178: E/AndroidRuntime(332): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 
09-10 13:48:29.178: E/AndroidRuntime(332): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 
09-10 13:48:29.178: E/AndroidRuntime(332): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 
09-10 13:48:29.178: E/AndroidRuntime(332): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 
09-10 13:48:29.178: E/AndroidRuntime(332): at android.os.Handler.dispatchMessage(Handler.java:99) 
09-10 13:48:29.178: E/AndroidRuntime(332): at android.os.Looper.loop(Looper.java:123) 
09-10 13:48:29.178: E/AndroidRuntime(332): at android.app.ActivityThread.main(ActivityThread.java:3683) 
09-10 13:48:29.178: E/AndroidRuntime(332): at java.lang.reflect.Method.invokeNative(Native Method) 
09-10 13:48:29.178: E/AndroidRuntime(332): at java.lang.reflect.Method.invoke(Method.java:507) 
09-10 13:48:29.178: E/AndroidRuntime(332): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
09-10 13:48:29.178: E/AndroidRuntime(332): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
09-10 13:48:29.178: E/AndroidRuntime(332): at dalvik.system.NativeStart.main(Native Method) 
09-10 13:48:29.178: E/AndroidRuntime(332): Caused by: java.lang.NoClassDefFoundError: com.google.common.collect.ImmutableBiMap 
09-10 13:48:29.178: E/AndroidRuntime(332): at com.example.android.nfc.record.UriRecord.<clinit>(UriRecord.java:51) 
09-10 13:48:29.178: E/AndroidRuntime(332): ... 18 more 
09-10 13:48:39.069: I/Process(332): Sending signal. PID: 332 SIG: 9 

回答

2
Caused by: java.lang.NoClassDefFoundError: com.google.common.collect.ImmutableBiMap 

看來你沒有在運行時類路徑有效番石榴庫。確保你已經將它們添加到lib文件夾。