swift droid
swift droid

Reputation: 107

Google map shows as a gray box android

Hi I have added my Google map api key in Android. manifest in my Xamarin.forms app. By using SHA1 finger print I got the API key. I used Google map sdk for android. But my map is not loading. It is just a gray box. How can I solve this? Please help me. Thanks

This is my Android.menifest code

<?xml version="1.0" encoding="UTF-8"?>

<manifest android:installLocation="internalOnly" package="com.companyname.ABC" android:versionName="1.0" android:versionCode="1"  xmlns:android="http://schemas.android.com/apk/res/android">

<uses-sdk android:minSdkVersion="15"/>

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<uses-permission android:name="android.permission.FLASHLIGHT"/>

<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>

<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

<uses-permission android:name="android.permission.INTERNET"/>


<application android:label="ABC.Android">

<meta-data android:name="com.google.android.geo.API_KEY" android:value="MY_API_KEY"/>

</application>

Upvotes: 1

Views: 217

Answers (2)

Blenm
Blenm

Reputation: 86

I've had this issue more recently. As mentioned in the accepted answer, Google Play Services are necessary (and need to be up-to-date) to display the map. In my case the services were installed and up-to-date.

For me, I was able to fix it by signing the build APK. Right click the .Android -> properties -> Android Package Signing -> Check off "sign the .APK file using the following keystore details" and fill out the keystore info.

It does make builds take a bit longer but you can uncheck at anytime and it saves your keystore details.

Upvotes: 0

Gerald Versluis
Gerald Versluis

Reputation: 34128

Is this on the emulator? Are the Google Play Services installed? For example, is there a store icon? If not, that is probably the problem. Those services are needed to show the map.

Please try on a physical device or install the Google Play Services on the emulator, there are some guides on internet that explain how depending on your emulator.

Upvotes: 1

Related Questions