maximus
maximus

Reputation: 11524

Eclipse cannot import import com.google.android.maps.*?

I am trying the google maps api for android, but eclipse does not import the com.google.android.maps.* files.

Source:

MyMapActivity:

package org.madmax.map;

import android.app.Activity;
import android.os.Bundle;
import com.google.android.maps.*;

public class MyMapActivity extends MapActivity {
    private MapView map;
    private MapController controller;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

in the Manifest file I have already declared:

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

How do I import the com.google.android.maps.* files?

Upvotes: 2

Views: 12218

Answers (2)

javram
javram

Reputation: 2645

It is not enough to just have the API SDK installed. From the android maps documentation,

http://code.google.com/android/add-ons/google-apis/maps-overview.html

If you want to add Maps to an existing application, right-click the project in Package Explorer, choose Properties > Android and then select a build target from the list displayed. You must choose the "Google APIs" build target.

(The standard Android packages don't include Google Maps)

Update, found a screenshot online, don't pick a Target with the name "Android x.x" pick the corresponding target that says "Google APIs" for the version of Android you want.

enter image description here

Upvotes: 15

IneQuation
IneQuation

Reputation: 1264

Make sure you have the Google APIs installed in your SDK. Open the SDK manager from the tools directory and use it to install the package.

Upvotes: 2

Related Questions