Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The import com.google cannot be resolved

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" />
like image 903
Josh Boothe Avatar asked Dec 09 '25 23:12

Josh Boothe


2 Answers

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

like image 185
Timothy T. Avatar answered Dec 11 '25 12:12

Timothy T.


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.

like image 33
CommonsWare Avatar answered Dec 11 '25 13:12

CommonsWare



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!