2012-08-27 116 views
0

我知道幾個帖子已經存在關於這個問題,但我花了幾天來找出什麼是錯誤的,我仍然得到這個錯誤,但我遵循在網上找到的所有步驟。NoClassDefFoundError與外部jar

我只是想這個jar添加到我的項目:https://github.com/jgilfelt/android-mapviewballoons/

我把它改成庫與他人罐子例如AdMob ... 它編譯文件夾,然後我就可以開始相關的MapActivity罐子(代碼來自於下載的上方,這是原來的代碼),當我點按地圖上的標記,應用程序崩潰,這裏是我所得到的:

08-27 14:07:45.872: E/InputEventReceiver(4206): Exception dispatching input event. 
08-27 14:07:45.872: E/MessageQueue-JNI(4206): Exception in MessageQueue callback: handleReceiveCallback 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): java.lang.NoClassDefFoundError: com.readystatesoftware.mapviewballoons.R$layout 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.readystatesoftware.mapviewballoons.BalloonOverlayView.setupView(BalloonOverlayView.java:79) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.readystatesoftware.mapviewballoons.BalloonOverlayView.<init>(BalloonOverlayView.java:58) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.createBalloonOverlayView(BalloonItemizedOverlay.java:151) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.createAndDisplayBalloonOverlay(BalloonItemizedOverlay.java:284) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.onTap(BalloonItemizedOverlay.java:126) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.google.android.maps.ItemizedOverlay.onTap(ItemizedOverlay.java:453) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.google.android.maps.OverlayBundle.onTap(OverlayBundle.java:83) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.google.android.maps.MapView$1.onSingleTapUp(MapView.java:356) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.google.android.maps.GestureDetector.onTouchEvent(GestureDetector.java:533) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.google.android.maps.MapView.onTouchEvent(MapView.java:683) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.readystatesoftware.maps.TapControlledMapView.onTouchEvent(TapControlledMapView.java:62) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.View.dispatchTouchEvent(View.java:7127) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2170) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1925) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1379) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.app.Activity.dispatchTouchEvent(Activity.java:2396) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1873) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.View.dispatchPointerEvent(View.java:7307) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3172) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3117) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4153) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4132) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4224) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.os.MessageQueue.nativePollOnce(Native Method) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.os.MessageQueue.next(MessageQueue.java:125) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.os.Looper.loop(Looper.java:124) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at android.app.ActivityThread.main(ActivityThread.java:4745) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at java.lang.reflect.Method.invokeNative(Native Method) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at java.lang.reflect.Method.invoke(Method.java:511) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
08-27 14:07:45.880: E/MessageQueue-JNI(4206): at dalvik.system.NativeStart.main(Native Method) 
08-27 14:07:45.880: W/dalvikvm(4206): threadid=1: thread exiting with uncaught exception (group=0x41fbb300) 
08-27 14:07:45.887: E/AndroidRuntime(4206): FATAL EXCEPTION: main 
08-27 14:07:45.887: E/AndroidRuntime(4206): java.lang.NoClassDefFoundError: com.readystatesoftware.mapviewballoons.R$layout 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.readystatesoftware.mapviewballoons.BalloonOverlayView.setupView(BalloonOverlayView.java:79) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.readystatesoftware.mapviewballoons.BalloonOverlayView.<init>(BalloonOverlayView.java:58) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.createBalloonOverlayView(BalloonItemizedOverlay.java:151) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.createAndDisplayBalloonOverlay(BalloonItemizedOverlay.java:284) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.readystatesoftware.mapviewballoons.BalloonItemizedOverlay.onTap(BalloonItemizedOverlay.java:126) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.google.android.maps.ItemizedOverlay.onTap(ItemizedOverlay.java:453) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.google.android.maps.OverlayBundle.onTap(OverlayBundle.java:83) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.google.android.maps.MapView$1.onSingleTapUp(MapView.java:356) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.google.android.maps.GestureDetector.onTouchEvent(GestureDetector.java:533) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.google.android.maps.MapView.onTouchEvent(MapView.java:683) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.readystatesoftware.maps.TapControlledMapView.onTouchEvent(TapControlledMapView.java:62) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.View.dispatchTouchEvent(View.java:7127) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2170) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1905) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2176) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1919) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1925) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1379) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.app.Activity.dispatchTouchEvent(Activity.java:2396) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1873) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.View.dispatchPointerEvent(View.java:7307) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3172) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3117) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:4153) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:4132) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:4224) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:171) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.os.MessageQueue.nativePollOnce(Native Method) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.os.MessageQueue.next(MessageQueue.java:125) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.os.Looper.loop(Looper.java:124) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at android.app.ActivityThread.main(ActivityThread.java:4745) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at java.lang.reflect.Method.invokeNative(Native Method) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at java.lang.reflect.Method.invoke(Method.java:511) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 
08-27 14:07:45.887: E/AndroidRuntime(4206):  at dalvik.system.NativeStart.main(Native Method) 

我希望有人能夠幫助我。

+0

既然你有mapviewballoons來源,爲什麼不把它作爲參考項目導入到你自己的項目中(而不是使用預編譯的jar)呢?與他們在GitHub項目站點上聲明的編譯示例應用程序類似。 – harism

+0

是的,就是這樣,謝謝。 – lost17

回答

1
  1. 將jar文件作爲項目導入到工作空間中。
  2. 從您的項目屬性中,將導入的項目引用爲庫項目。
  3. 編譯你的項目。
+1

謝謝,除了我不知道如何去做。我發現我只是去屬性> Android選項卡,然後從底部的窗口添加項目... – lost17

相關問題