How To Fix Google Maps "Authentication Failed On The Server"?
Since the SHA1 key differs from release to debug, you can keep both keys in your manifest but comment out the release version key while testing locally. Like so:
Edit (April 28 2016) - With Android Studio and build flavors, this technique is unnecessary considering you can point to different strings given a buildType (debug or release) and flavor. I would now recommend andorid:value="@string/maps_v2_api_key"
instead of hard coding as such.
buildTypes {
release {
resValue 'string', 'maps_v2_api_key', '"123...xyz"'
}
debug {
resValue 'string', 'maps_v2_api_key', '"345...vut"'
}
}
Solution 2:
i have same problem i spent two weeks to get a solution at last i got it. just remove key from res/values/google_maps_api.c and repalace it by new key follow below steps you will get a new key.
1> Find SHA1 by Using that command in command prompt:
keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android
2> Get Package name from android manifest and use finger print of SHA1 for create an new api key
3> copy created key and past it in res/values/google_maps_api.xml and also past in android manifest
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">Paste Here New Api</string>
</resources>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="Paste Key Here" />
Solution 3:
The keys for release and debug versions would be different. Also you could have as many flavours as you can. Check this at left menu(corner) of Android Studio, called BuildVariants
Solution 4:
I had a similar problem, for me the fix was to just add google play services in the android sdk manager and then regenerate the api key.
Solution 5:
And generate the key from credentials tab. Add the package name(application id) and SHA-1 for your project and you are done.
Post a Comment for "How To Fix Google Maps "Authentication Failed On The Server"?"