issues in displaying map data with map integration - android

My issue is when i am running the app it shows Google icon in left corner in app and little grey colour in activity but it does not show google map.can any one solve this problem with intilligence i refer lot of websites ?
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.animateCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.anilkumar.mapsactivity">
<permission android:name="com.example.anilkumar.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.example.anilkumar.permission.MAPS_RECEIVE"/>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme"
android:name="android.support.multidex.MultiDexApplication">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

Make sure you have enabled location permission if you are testing on marshmallow devices
Using the correct google maps api key, and setting enabled google maps api in your console
Still getting errors follow these tutorials
this, this, this, this, this
Hope it helps you

Related

Google maps fragment showing empty map

I've wanted to add a map to my app and I have followed all the instructions on the google maps api website.
1. I have made the project and added a new google maps activity.
2. I have gotten an api key from the link provided in google_maps_api.xml and entered it.
3. I have added the permissions:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
4. I have added the meta data :
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
But when I open the activity, the google logo is there but it shows an empty map. Why is this happening and what's the solution?
Here's my code:
Androidmanifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.barlificent.transport">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
MapActivity.java
package com.barlificent.transport;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements
OnMapReadyCallback {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
Comments above seem to be correct. I ran into this same apparent issue and when I looked further into the developers console, you may indeed need to create a new key or project. As your key can also be restricted to Android, iOS, or certain Http Referers and more, the key you are attempting to use might be restricted in a way that prevents it from working with an Android app. In my case, I created a new project and just create a key for it. You could also try changing the key restrictions on the current API key, but it seems best to me to have a separate key for separate activities.
Login to your developer console:
https://console.developers.google.com
Create a project and make sure it is selected in the drop down to
the right of the Google APIs logo.
Click on the drop down menu to the left of the GoogleAPIs logo.
Select API's & Services > Credentials
Click Create credentials > API Key
Optionally restrict your key.

Google map not showing in android activity?

In my android app I want to have a MainActivity with a google map occupying the entire screen.
My problem is that the google map does not display a map, only the google logo in the bottom left corner:
Here are the relevant parts of the main activity where the map should be displayed:
public class MainActivity extends AppCompatActivity implements OnMapReadyCallback,
NavigationView.OnNavigationItemSelectedListener {
private GoogleMap mMap;
private FragmentManager mFragmentManager;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
setupLayout();
mFragmentManager = getSupportFragmentManager();
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
Here is the xml for the content of the main activity which holds the google map fragment:
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.purringcat.stray.view.activity.MainActivity"/>
Here is the manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.purringcat.stray">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application
android:name=".Stray"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".view.activity.MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity
android:name=".view.activity.LoginActivity"
android:label="#string/title_activity_login"
android:theme="#style/AppTheme.NoActionBar">
</activity>
<activity android:name=".view.activity.SignUpActivity">
</activity>
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key"/>
</application>
</manifest>
You need to enable google map api from google console for your project. And also you need to download json file from the console.
1. Go to google console
2. click on your project.
3. Click on library section from left menu panel. see below image
In google maps api, click on Google maps android api
Than enable that.
Now Goto firebase console
Click on your project and goto project settings and download the json file.
Add that json file in your application.
I just checked with google map like yours.
Just compare your code with mine.
MainActivity.java
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney and move the camera
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
And Manifest
<?xml version="1.0" encoding="utf-8"?>
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Note: You have to create a project in google
click here to visit the google console
Replace your Key value in the google_maps_api
<resources>
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">Your Key</string>
Hope this works for you.
PS: you can generate google map activity from android studio.
Add this permissions to menifest
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />
OR Check in google console is API ENABLED
OR Check your google_api_key
Include the following code in AndroidManifest.xml file, within the application part:
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
See documentation here.
Google maps likes to get the different activity lifecycle states. So you should send it: map_view.onCreate(savedInstanceState) and map_view.onResume(). It also likes onPause(), onLowMemory(), onSaveInstanceState(outState), onDestroy() if they occur.
click on Restrict key and then in API restrictions->don't Restrict key while creating api
1) Please update google play services
2) Please append your api key in the url
Ex:-"https://maps.googleapis.com/maps/api/directions/" + output + "?" + parameters + "&key=" + MY_API_KEY;
Make sure that you have given these permisssions
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
and check if the WiFi of AVD is on and your PC is connected to internet.
I was getting the same problems, and following the above mentioned steps I was able to resolve my problem.
If the Activity is Opening and the map is not visible even if you are giving Google_map_key , then one solution that worked for me is that i created a new Google map API KEY by copying the link in the google_maps_api.xml and pasting in the browser. Select a project or create a project it will land you on the page where google API KEY is ready copy it and paste it in the place given in the instruction .it will work.

Google maps shows blank page in Android app

I am not a programmer but am doing a very basic android development app through work.
I have managed to set up all the config keys in order to get a google map screen in my app up and running. However, when I click to open the map screen it shows a blank map (only showing a google logo at the bottom of my screen).
I have looked at questions from people here with similar issue, so I suspect I need to add certain permissions in my android manifest and also play a bit with my java code? So really hoping someone would be able to look into my code and point me to the right direction (kind of baby steps...)
Thanks
Android Manifest xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.learn5things">
<!--
The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
Google Maps Android API v2, but you must specify either coarse or fine
location permissions for the 'MyLocation' functionality.
-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LocationActivity" />
<activity android:name=".CultureActivity" />
<activity android:name=".FoodActivity" />
<activity android:name=".FootballActivity" />
<activity android:name=".CarnavalActivity" />
<!--
The API key for Google Maps-based APIs is defined as a string resource.
(See the file "res/values/google_maps_api.xml").
Note that the API key is linked to the encryption key used to sign the APK.
You need a different API key for each encryption key, including the release key that is used to
sign the APK for publishing.
You can define the keys for the debug and release targets in src/debug/ and src/release/.
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="#string/google_maps_key" />
<activity
android:name=".MapsActivity"
android:label="#string/title_activity_maps"></activity>
</application>
</manifest>
Activity maps (XML)
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.android.learn5things.MapsActivity" />
Maps Activity (java file)
package com.example.android.learn5things;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
#Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Brazil and move the camera
LatLng brazil = new LatLng(-8.892710, -56.098682);
mMap.addMarker(new MarkerOptions().position(brazil).title("Marker in Brazil"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(brazil));
}
}
You have to clarify Google Play Services version in your manifest.xml file under application tag:
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
Also, I think your google maps api key should be referenced as:
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="#string/google_maps_key" />
Also, make sure you put your actual Google Maps Key in your strings file!
Hope it helped.
Source

Map displaying a grey area - android

What is possibly wrong with this code?
I'm not seeing what could possibly be intrefering and the API key is right but it continues to show a grey area.
Can someone give a touch on this?
MAIN ACTIVITY
package com.example;
*ALL THE IMPORTS
public class MainActivity extends Activity {
private GoogleMap googleMap;
private int mapType = GoogleMap.MAP_TYPE_NORMAL;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager fragmentManager = getFragmentManager();
MapFragment mapFragment = (MapFragment) fragmentManager.findFragmentById(R.id.map);
googleMap = mapFragment.getMap();
googleMap.setMapType(mapType);
}
}
ACTIVITY_MAIN.XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="#+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
class="com.google.android.gms.maps.MapFragment"/>
</RelativeLayout>
MANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="17"/>
<permission
android:name="com.example.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<!--Required permissions-->
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!--Used by the API to download map tiles from Google Maps servers: -->
<uses-permission android:name="android.permission.INTERNET"/>
<!--Allows the API to access Google web-based services: -->
<uses-permission
android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!--Allows the API to cache map tile data in the device's external storage area: -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!--Optional permissions-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!--Version 2 of the Google Maps Android API requires OpenGL ES version 2 -->
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<application
android:label="#string/app_name"
android:icon="#drawable/ic_launcher">
<activity
android:name="com.example.MainActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="my api"/>
</application>
</manifest>
Seriously, this maps thing is driving me mad.
Check these things
Correct API Key and
in manifest
Google maps should be on in your devloper console
INTERNET PERMISSION in manifest
Updated google play services
Ok, I found a solution, pretty stupid in my opinion but it worked.
I had to declare the api key in the layout.xml
After that, everything worked like charm

Android - Google maps Api v2 - Authentication error

After a lot of research to resolve my issue, I have to ask. Everything is set up but the map won't show. The error is:
08-16 20:31:49.473: E/Google Maps Android API(10864): Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
I am running the Map on Debug mode (I've also tried by installing the .apk into the device and running it) and the same thing happens - no Map.
I have checked Api key
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
... >
<permission
android:name="com.my_package_name.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<uses-permission android:name="com.my_package_name.permission.MAPS_RECEIVE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
... >
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyCEH*************************" />
</application>
</manifest>
Activity
public class Home extends Activity {
static final LatLng HAMBURG = new LatLng(53.558, 9.927);
static final LatLng KIEL = new LatLng(53.551, 9.993);
private GoogleMap map;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
}
}
It's an authentication issue, it's likely you haven't setup your API key correctly, using your SHA1 fingerprint.
Take a look at this
Activate these Services in the Google Console:
Google Maps Android API v2
Then, recreate the API key and the Maps should work - they did for me.
Put this into your manifest.
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version"></meta-data>
Also check that the Consent Screen (on Google Developer Console Website > Settings) has your email address and product name.

Categories

Resources