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.
Do the following to solve the issue:
Finally: click on "+" button
After that, clean and rebuild the project!
Add google play services to your project
To make the Google Play services APIs available to your app:
Open the build.gradle file inside your application module directory.
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'
}
Save the changes and click Sync Project with Gradle Files in the toolbar.
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
implementation "com.google.android.gms:play-services-location:15.0.1"
implementation "com.google.android.gms:play-services-places:15.0.1"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With