jason hong
jason hong

Reputation: 445

Error, NoClassDefFound

on MainActivity.java I have

     host.addTab(host.newTabSpec("Map")
            .setIndicator("Map",     getResources().getDrawable(R.drawable.icon_user))
            .setContent(new Intent(this, Map.class)));

On Map.Java

 public class Map extends MapActivity {

MapView mapView;

 SharedPreferences prefs;

  SharedPreferences.Editor prefEditor; 

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.map);

    MapView mapView = (MapView) findViewById(R.id.myMapView1);
    }

On my Android.XML I have included

    <activity android:name=".Map"
              android:label="@string/app_name">
    </activity>   

The error line is in the MainActivity.java's host.addTab of Map.java class. It says NodefClassFound. What does it even means? I have defined in all the necessay areas. No syntax error, but runtime error.

Upvotes: 0

Views: 645

Answers (1)

tungi52
tungi52

Reputation: 642

You could have posted the stacktrace of this error. My guess: try to add these two lines to your manifest (if they are not there yet):

<uses-library android:name="com.google.android.maps" />

<uses-permission android:name="android.permission.INTERNET" />

The first one must be inside the application tag.

Upvotes: 1

Related Questions