带外部jar的NoClassDefFoundError

时间:2012-08-27 12:19:17

标签: android jar noclassdeffounderror

我知道有关此问题的几个帖子已经存在,但我花了好几天才发现错误,但我仍然遇到此错误,但我按照网络上的所有步骤进行操作。

我只是想把这个jar添加到我的项目中:https://github.com/jgilfelt/android-mapviewballoons/

我把它放到libs文件夹中,与其他jar如admob ... 它编译,然后我可以启动与jar相关的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)

我希望有人可以帮助我。

1 个答案:

答案 0 :(得分:1)

  1. 将jar文件作为项目导入到work_space中。
  2. 从项目属性中,将导入的项目引用为库项目。
  3. 编译你的项目。