coder
coder

Reputation: 6235

import cannot be resolved: import com.google.android.maps.*;

I was successfully using google maps in my application but then needed to change the Android SDK version from 1.5 to 2.0. Now the import for Google maps can't be resolved.

Upvotes: 20

Views: 52644

Answers (6)

Alekh
Alekh

Reputation: 25

Add compile 'com.google.maps.android:android-maps-utils:0.5+'

in dependency section of your build.gradle

Upvotes: 1

Ricardus
Ricardus

Reputation: 739

Doing right-click Properties->Android and selecting a Target Name Google APIs instead of Android x.x fixed the problem for me.

Upvotes: 4

kmne68
kmne68

Reputation: 1

You may also need to add google-play-services_lib to the project's list of libraries. Doing so resolved this issue for me.

Right-click project->properties->Android

Click the 'Add...' button found to the right of the Library Reference/Project table.

If you have downloaded the Google Play Services Library with the SDK Manager, you should see the library as a choice in the Project Selection box that pops up when you press the Add button.

If you have not downloaded Google Play Services follow the instructions here: http://developer.android.com/google/play-services/setup.html

Upvotes: 0

jpCoder411
jpCoder411

Reputation: 207

adding google-play-services.jar to my project's path solved my problem.

right click project->properties->java build path-> libraries tab -> add external jar

browse to android-sdk folder->extras\google\google-play-services\libproject\google-play-services_lib\libs\

If you don't have google-play-services folder then you need to close eclipse and open up the SDK manager separately and download google-play.

If you already downloaded google-play and still don't see your google-play-services folder, then you need to search for it....chances are that you have multiple android sdks installed....

Upvotes: 15

sumit pandey
sumit pandey

Reputation: 1221

1.Install all google API's using sdk manager.

2.In your manifest,under application element add

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

3.You have to include jar file for maps also.. Right click on your project and go to build path and then add external archives. locate your sdk. android-sdk-windows\add-ons\addon_google_apis_google_inc_8\libs\maps

Upvotes: 13

Yoni Samlan
Yoni Samlan

Reputation: 38065

Make sure you have

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

in your application manifest, and that you've downloaded not just the 2.0 SDK but the 2.0-with-google-APIs SDK. Then set your project's properties in Eclipse to check off the Google APIs version of the SDK you want. Then try to clean your build (Project-> Clean in eclipse; "ant clean" from the command line).

Upvotes: 24

Related Questions