I've followed the steps here and here to create a MapView
in our teams project which we sync with svn. After following the steps, MapView
was running smooth, but only on my laptop. My project members are always getting
02-06 13:27:37.327: E/Google Maps Android API(19490): Authorization failure.
when opening the MapView
. So I deleted the old one and generated a new SHA1 fingerprint for a new Google API Key on another laptop with my Google Account with:
keytool -list -alias androiddebugkey -keystore ~/.android/debug.keystore -storepass android -keypass android -v
So now it's working on the other laptop where I generated the SHA1 fingerprint but when I try to run the project on my laptop I'm now getting the
02-06 13:29:51.280: E/Google Maps Android API(20262): Authorization failure.
Error.
We are not using proguard-project.txt
, we tried different devices where google-play-services
is installed and included /extras/google/google_play_services/libproject/google-play-services_lib
as a library. We also tried to generate multiple API Keys but only one was working.
What are we doing wrong? Do we have to use different Google Accounts to create individual keys?
You have two options here.
Add a separate line to the api key for each device you have.
Extract the api key to a file (eg. map_key.xml
) and reference this file from the AndroidManifest.xml
.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_api_key_v2" />
Add this file to your .gitignore - so now each project member can override with its own key.