Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

com.google.android.gms.maps.MapFragment: Cannot resolve symbol "maps"

I've followed all of the directions here with no issues:

https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2

Finally, I follow the last instruction to test if the map is working, updating my activity_map.xml file with:

<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
          android:id="@+id/map"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:name="com.google.android.gms.maps.MapFragment"/>

However, in the last line, everything after com.google is red, and on mouse over I get the message that "Cannot resolve symbol 'MapFragment'.

Any ideas would be a big help right now.

like image 652
somecbusnerd Avatar asked Nov 13 '14 04:11

somecbusnerd


3 Answers

Do the following to solve the issue:

Install Google Play services

Go File->Project Structure...

Dependencies Tab, Add com.google.android.gms

Finally: click on "+" button

enter image description here

After that, clean and rebuild the project!

like image 146
Abdulkarim Kanaan Avatar answered Sep 20 '22 15:09

Abdulkarim Kanaan


Add google play services to your project

To make the Google Play services APIs available to your app:

  1. Open the build.gradle file inside your application module directory.

  2. add a new build rule under dependencies for the latest version of play-services

example

apply plugin: 'com.android.application'
...

dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
}
  1. Save the changes and click Sync Project with Gradle Files in the toolbar.

  2. Open your app's manifest file and add the following tag as a child of the <application> element:

    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

This steps will remove the above mentioned error.This particular solution is for android studio only.

for more info visit : http://developer.android.com/google/play-services/setup.html

like image 33
kkk Avatar answered Sep 20 '22 15:09

kkk


implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-places:15.0.1"
like image 41
Soumen Das Avatar answered Sep 18 '22 15:09

Soumen Das