I recently observed an issue when debugging my Xamarin.Forms.Android solution which uses Xamarin.FormsMaps in two different development environments.
The problem was, that I received an error stating that I was missing authentication with the Google Maps API in only one development environment.
Solving the issue
This guide assumes that you have already succesfully established a connection with the Google Maps API in at least one development environment. If you havn’t already worked with Xamarin.FormsMaps before, here is a guide on how to get started, and here is a detailed list of the required permissions in your Android project.
Anywho, on to the issue at hand:
- First, obtain the SHA1 fingerprint from your debug key by following this guide
- While you’re at it, grab the SHA1 fingerprint for your release key as well by following the same process, but by select the certificate you use for release
- Open the Google Developers Console
- Select your project and navigate to “APIs & auth” => “Credentials”
- In here, click “Edit allowed Android applications”
- For each key you have (I’ve got 3 in total: 2 development enviroments, and 1 release certifcate) add a new line with the following contents:
- <SHA1-fingerprint>;com.your.packagename
- Click “Update”
By now, your “Key for Android applications” should resemble that of the screenshot below. If it does, the Google Maps API has been succesfully registered with both your development and release certficates.
// Dave