2

I am trying to do a Map View in android (migrating from iOS). In the android SDK pannel I have google APIs (API 17) installed, which I was hoping would fix the problem. So in my source code I have:

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

And its giving me the error: The import com.google cannot be resolved. I have searched google for a result, but they havent worked (most of them were making sure the Google API is installed.

I am on a Macbook Pro, 64 bit using Eclipse ADT downloaded from the android dev site.

In the AndroidManifest.xml file I have:

<uses-library android:name="com.google.android.maps" />
Josh Boothe
  • 1,413
  • 4
  • 25
  • 40
  • 1
    i guess you are using map pai v1 which is depreceated. you should use map api v2. https://developers.google.com/maps/documentation/android/start – Raghunandan Jun 14 '13 at 14:01
  • @Raghunandan Ahh I see, all the info on this is 2011 or before, so that could be why it isnt working. I will look for a tutorial for V2 – Josh Boothe Jun 14 '13 at 14:02
  • http://stackoverflow.com/questions/17096745/google-maps-api-v3-shows-gray-boxes-only/17097135#17097135. similar question – Raghunandan Jun 14 '13 at 14:03

2 Answers2

9

You have to add the library to your project.

You can find the .jar file in your sdk sdk\add-ons\addon-google_apis-google-17\libs\maps.jar

Thread about how to add a library in your android project : Adding a library/JAR to an Eclipse Android project

Community
  • 1
  • 1
Timothy T.
  • 602
  • 4
  • 10
  • If you're using `ant` to build your project, just copying maps.jar to `libs/` will work. – domen Oct 17 '13 at 08:41
1

You also need to set the build target (Project > Properties > Android) to be a build target that has the Google APIs in it, to use Maps V1.

That being said, Raghunandan is correct -- you should be using Maps V2, as you can no longer get Maps V1 API keys. Note that Maps V2 does not require you to have a "Google APIs" build target.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491