我在我的 android 项目的同一个 java 文件中声明了一个类,我的代码由于某种原因无法识别它?当我在模拟器中运行它时,我在运行时得到一个 NoClassDefFoundError 。
当我尝试在模拟器中运行我的 android 应用程序时出现以下错误:
01-16 19:58:41.394: E/dalvikvm(2648): Could not find class 'nl.sogeti.android.gpstracker.viewer.map.overlay.AsyncOverlay$SegmentOsmOverlay', referenced from method nl.sogeti.android.gpstracker.viewer.map.overlay.AsyncOverlay.<init>
01-16 19:58:41.394: W/dalvikvm(2648): VFY: unable to resolve new-instance 939 (Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentOsmOverlay;) in Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay;
01-16 19:58:41.394: D/dalvikvm(2648): VFY: replacing opcode 0x22 at 0x0044
01-16 19:58:41.394: W/dalvikvm(2648): Unable to resolve superclass of Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentMapQuestOverlay; (562)
01-16 19:58:41.394: W/dalvikvm(2648): Link of class 'Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentMapQuestOverlay;' failed
01-16 19:58:41.404: W/dalvikvm(2648): VFY: unable to find class referenced in signature (Lcom/mapquest/android/maps/Overlay;)
01-16 19:58:41.404: W/dalvikvm(2648): Unable to resolve superclass of Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentOsmOverlay; (1422)
01-16 19:58:41.404: W/dalvikvm(2648): Link of class 'Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentOsmOverlay;' failed
01-16 19:58:41.414: W/dalvikvm(2648): VFY: unable to find class referenced in signature (Lorg/osmdroid/views/overlay/Overlay;)
01-16 19:58:41.414: W/dalvikvm(2648): Unable to resolve superclass of Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentOsmOverlay; (1422)
01-16 19:58:41.414: W/dalvikvm(2648): Link of class 'Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentOsmOverlay;' failed
01-16 19:58:41.427: D/dalvikvm(2648): DexOpt: unable to opt direct call 0x16f6 at 0x4e in Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay;.<init>
01-16 19:58:41.434: W/dalvikvm(2648): Unable to resolve superclass of Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentMapQuestOverlay; (562)
01-16 19:58:41.434: W/dalvikvm(2648): Link of class 'Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay$SegmentMapQuestOverlay;' failed
01-16 19:58:41.434: D/dalvikvm(2648): DexOpt: unable to opt direct call 0x16f2 at 0x55 in Lnl/sogeti/android/gpstracker/viewer/map/overlay/AsyncOverlay;.<init>
01-16 19:58:41.468: D/AndroidRuntime(2648): Shutting down VM
01-16 19:58:41.474: W/dalvikvm(2648): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
01-16 19:58:41.514: E/AndroidRuntime(2648): FATAL EXCEPTION: main
01-16 19:58:41.514: E/AndroidRuntime(2648): java.lang.NoClassDefFoundError: nl.sogeti.android.gpstracker.viewer.map.overlay.AsyncOverlay$SegmentOsmOverlay
01-16 19:58:41.514: E/AndroidRuntime(2648): at nl.sogeti.android.gpstracker.viewer.map.overlay.AsyncOverlay.<init>(AsyncOverlay.java:92)
01-16 19:58:41.514: E/AndroidRuntime(2648): at nl.sogeti.android.gpstracker.viewer.map.overlay.BitmapSegmentsOverlay.<init>(BitmapSegmentsOverlay.java:23)
01-16 19:58:41.514: E/AndroidRuntime(2648): at nl.sogeti.android.gpstracker.viewer.map.LoggerMapHelper.onCreate(LoggerMapHelper.java:195)
01-16 19:58:41.514: E/AndroidRuntime(2648): at nl.sogeti.android.gpstracker.viewer.map.GoogleLoggerMap.onCreate(GoogleLoggerMap.java:90)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.app.Activity.performCreate(Activity.java:5104)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.os.Handler.dispatchMessage(Handler.java:99)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.os.Looper.loop(Looper.java:137)
01-16 19:58:41.514: E/AndroidRuntime(2648): at android.app.ActivityThread.main(ActivityThread.java:5039)
01-16 19:58:41.514: E/AndroidRuntime(2648): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 19:58:41.514: E/AndroidRuntime(2648): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 19:58:41.514: E/AndroidRuntime(2648): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-16 19:58:41.514: E/AndroidRuntime(2648): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-16 19:58:41.514: E/AndroidRuntime(2648): at dalvik.system.NativeStart.main(Native Method)
01-16 19:59:01.474: W/Trace(2666): Unexpected value from nativeGetEnabledTags: 0
这是我的代码:
AsyncOverlay(LoggerMap loggermap, Handler handler)
{
mLoggerMap = loggermap;
mHandler = handler;
mWidth = 1;
mHeight = 1;
mPaint = new Paint();
mActiveZoomLevel = -1;
mActiveBitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888);
mActiveTopLeft = new GeoPoint(0, 0);
mActivePointTopLeft = new Point();
mCalculationBitmap = Bitmap.createBitmap(mWidth, mHeight, Bitmap.Config.ARGB_8888);
mOsmOverlay = new SegmentOsmOverlay(mLoggerMap.getActivity(), mLoggerMap, this);
mMapQuestOverlay = new SegmentMapQuestOverlay(this);
}
这是我的课:
static class SegmentOsmOverlay extends org.osmdroid.views.overlay.Overlay {
AsyncOverlay mSegmentOverlay;
LoggerMap mLoggerMap;
public SegmentOsmOverlay(Context ctx, LoggerMap map, AsyncOverlay segmentOverlay)
{
super(ctx);
mLoggerMap = map;
mSegmentOverlay = segmentOverlay;
}
public AsyncOverlay getSegmentOverlay()
{
return mSegmentOverlay;
}
@Override
public boolean onSingleTapUp(MotionEvent e, org.osmdroid.views.MapView openStreetMapView)
{
int x = (int) e.getX();
int y = (int) e.getY();
GeoPoint tappedGeoPoint = mLoggerMap.fromPixels(x, y);
return mSegmentOverlay.commonOnTap(tappedGeoPoint);
}
@Override
protected void draw(Canvas canvas, org.osmdroid.views.MapView view, boolean shadow)
{
if (!shadow)
{
mSegmentOverlay.draw(canvas);
}
}
}
有什么建议么?