The import com.google cannot be resolved
Solution 1
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
Solution 2
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.
Josh Boothe
Updated on September 07, 2022Comments
-
Josh Boothe over 1 year
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" />
-
domen over 10 yearsIf you're using
ant
to build your project, just copying maps.jar tolibs/
will work.