1

i have one problem,I am doing one map app where i need to use some floating menu.i found one pretty good example,it was posted in this site(QuickAction).But when i include this project to buildpath of my project,i get a NoClassDefError. Heres my log.

LogCat:

03-14 15:19:17.858: W/dalvikvm(1807): VFY: unable to find class referenced in signature (Lnet/londatiga/android/QuickAction;)
03-14 15:19:17.888: E/dalvikvm(1807): Could not find class 'net.londatiga.android.ActionItem', referenced from method com.gps.gpsclient.GPSClientActivity.createFloatingMenu
03-14 15:19:17.888: W/dalvikvm(1807): VFY: unable to resolve new-instance 646 (Lnet/londatiga/android/ActionItem;) in Lcom/gps/gpsclient/GPSClientActivity;
03-14 15:19:17.888: D/dalvikvm(1807): VFY: replacing opcode 0x22 at 0x0000
03-14 15:19:17.898: D/dalvikvm(1807): DexOpt: unable to opt direct call 0x0f95 at 0x02 in Lcom/gps/gpsclient/GPSClientActivity;.createFloatingMenu
03-14 15:19:17.908: D/dalvikvm(1807): DexOpt: unable to opt direct call 0x0f98 at 0x20 in Lcom/gps/gpsclient/GPSClientActivity;.createFloatingMenu
03-14 15:19:17.968: I/org.osmdroid.views.MapView(1807): Using tile source: org.osmdroid.tileprovider.tilesource.XYTileSource@410e7460
03-14 15:19:17.978: I/org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase(1807): sdcard state: mounted
03-14 15:19:17.978: I/org.osmdroid.tileprovider.modules.MapTileFileStorageProviderBase(1807): sdcard state: mounted
03-14 15:19:18.038: I/org.osmdroid.tileprovider.MapTileProviderBase(1807): rescale tile cache from 0 to 10
03-14 15:19:18.088: I/org.osmdroid.tileprovider.MapTileProviderBase(1807): Finished rescale in 44ms
03-14 15:19:18.098: D/dalvikvm(1807): GC_CONCURRENT freed 141K, 3% free 6877K/7047K, paused 2ms+7ms
03-14 15:19:18.128: D/dalvikvm(1807): GC_FOR_ALLOC freed 39K, 4% free 7144K/7431K, paused 28ms
03-14 15:19:18.258: D/dalvikvm(1807): GC_CONCURRENT freed 206K, 3% free 7467K/7687K, paused 2ms+3ms
03-14 15:19:18.258: D/AndroidRuntime(1807): Shutting down VM
03-14 15:19:18.268: I/dalvikvm(1807): threadid=3: reacting to signal 3
03-14 15:19:18.288: W/dalvikvm(1807): threadid=1: thread exiting with uncaught exception (group=0x40a671f8)
03-14 15:19:18.298: I/dalvikvm(1807): Wrote stack traces to '/data/anr/traces.txt'
03-14 15:19:18.298: E/AndroidRuntime(1807): FATAL EXCEPTION: main
03-14 15:19:18.298: E/AndroidRuntime(1807): java.lang.NoClassDefFoundError: net.londatiga.android.ActionItem
03-14 15:19:18.298: E/AndroidRuntime(1807):     at com.gps.gpsclient.GPSClientActivity.createFloatingMenu(GPSClientActivity.java:61)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at com.gps.gpsclient.GPSClientActivity.onCreate(GPSClientActivity.java:47)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.app.Activity.performCreate(Activity.java:4492)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.os.Looper.loop(Looper.java:137)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at android.app.ActivityThread.main(ActivityThread.java:4424)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at java.lang.reflect.Method.invokeNative(Native Method)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at java.lang.reflect.Method.invoke(Method.java:511)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
03-14 15:19:18.298: E/AndroidRuntime(1807):     at dalvik.system.NativeStart.main(Native Method)
03-14 15:19:18.558: D/dalvikvm(1807): GC_CONCURRENT freed 406K, 7% free 7450K/7943K, paused 3ms+2ms
03-14 15:19:18.768: I/dalvikvm(1807): threadid=3: reacting to signal 3
03-14 15:19:18.768: I/dalvikvm(1807): Wrote stack traces to '/data/anr/traces.txt'
03-14 15:19:18.888: I/dalvikvm(1807): threadid=3: reacting to signal 3
03-14 15:19:18.898: I/dalvikvm(1807): Wrote stack traces to '/data/anr/traces.txt'

I think its somethink with that buildpath,but this is first time i include full project to buildpath,so i dont have any experience with that.Imports works normal.

Activity:

package com.gps.gpsclient;



import net.londatiga.android.ActionItem;
import net.londatiga.android.QuickAction;

import org.osmdroid.tileprovider.tilesource.TileSourceFactory;
import org.osmdroid.util.GeoPoint;
import org.osmdroid.views.MapController;
import org.osmdroid.views.MapView;



import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import org.osmdroid.views.MapView;


import com.gps.gpsclient.R;




public class GPSClientActivity extends Activity {

private MapView view;
private MapDrawer mainDrawer;
private QuickAction mQuickAction; 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gps);
        view = (MapView) findViewById(R.id.mapView);
        view.setTileSource(TileSourceFactory.MAPNIK);
        view.setBuiltInZoomControls(true);
        MapController mapController = view.getController();
        mapController.setZoom(10);
        GeoPoint point2 = new GeoPoint(51496994, -134733);
        mapController.setCenter(point2);
        mainDrawer=new MapDrawer(view);
        createFloatingMenu();
        final Button button = (Button) findViewById(R.id.addButton);
        button.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View arg0, MotionEvent arg1) {
                mQuickAction.show(view);
                return false;
            }
        }); 

    }

    public void createFloatingMenu()
    {
        ActionItem item=new ActionItem();
        item.setIcon(getResources().getDrawable(R.drawable.ic_launcher));
        item.setTitle("Custom");
        mQuickAction =new QuickAction(view.getContext());
        mQuickAction.addActionItem(item);


    }


}

Hope you can help

Ján Srniček
  • 505
  • 1
  • 10
  • 34

1 Answers1

3

Clean and build.

If that doesn't help then restart Eclipse and clean and build again.

Edit

You said:

.But when i include this project to buildpath of my project,i get a NoClassDefError.

It seems that you have some library project included in your build path.You need to mark this external project as a library project. To do that, after importing the project into the workspace go to your main project. Right Click and go to properties.. and select the "Android" group on the left. On the right pane you will find a Library panel in the extreme bottom. Click on add and find and add the other project to it and mark it as a library project.

enter image description here

After doing this,clean build and do what I said earlier. See this Q/A as well.

halfer
  • 19,824
  • 17
  • 99
  • 186
Nezam
  • 4,122
  • 3
  • 32
  • 49