Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The import com.google.android.gms cannot be resolved

I am new to Android development. By following this tutorial I got errors The import com.google.android.gms cannot be resolved when I wrote the code into the MainActivity.java:

import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.MapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.Marker; import com.google.android.gms.maps.model.MarkerOptions; 

By searching for various fixes I made sure to try these out:

  • I have downloaded Google API's for a particular API level through Android SDK manager.
  • I checked off Google API as project build target.
  • I have added <uses-library android:name="com.google.android.maps" /> line into the AndroidManifest.xml as a child of <application> tag.
  • I cleaned the project by selecting Project->Clean... and built it from scratch.
  • I included .jar file for maps by right-clicking on my project, went to build path and added external archive locating it in my SDK: android-sdk-windows\add-ons\addon_google_apis_google_inc_8\libs\maps

Unfortunately, none of the above have helped.

like image 593
Arnoldas Bendoraitis Avatar asked Apr 13 '13 16:04

Arnoldas Bendoraitis


1 Answers

Another way is to let Eclipse do the import work for you. Hover your mouse over the com.google.android.gms import that can not be resolved and towards the bottom of the popup menu, select the Fix project setup... option as below. Then it'll prompt to import the google play services library. Select that and you should be good to go.

enter image description here

like image 64
tipycalFlow Avatar answered Oct 04 '22 15:10

tipycalFlow