I have printed my SHA1 key:
keytool -list -v -keystore keystore.jks
generated an API key in Google Console,
updated the manifest file as follows:
<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="AIzaSyC1YOsomestringsarehiddedLu5_TnCxlyuRM"/>
Then I created a simple Activity
as in Google Samples:
public class MapActivity extends FragmentActivity implements OnMapReadyCallback {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_sample);
SupportMapFragment mapFragment =
(SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap map) {
map.addMarker(new MarkerOptions().position(new LatLng(0, 0)).title("Marker"));
}
}
And of course I added the activity inside Manifest file. I always get the same error.
Ensure that the following Android Key exists:
API Key: AIzaSyC1YOn9myapikeystringsxxu5_TnCxlyuRM
Android Application (<cert_fingerprint>;<package_name>):
B2:E8:75:4F:01:DD:xx:xx:xx:xx:xx:xx:74:A5:85:2C:A4:38:48;md.mycompany.catalog
The strange part is that the SHA1 key which I pasted in Google Console is not the same as the one above. I tried again, and it still shows another SHA1 key. I even tried this SHA1 and still it does not work.
p.s. I have Youtube API integrated in same app, and everything works perfectly, with same KEY.
You may need to update your Google Maps app, connect to a stronger Wi-Fi signal, recalibrate the app, or check your location services. You can also reinstall the Google Maps app if it isn't working, or simply restart your iPhone or Android phone.
Clear the app's cache & data On your Android phone or tablet, open the Settings app . Tap Apps & notifications. Follow the steps on your device to find the Maps app. After you select the app, storage & cache options should be available.
There are a several reasons why your google maps may not be working, the most common issue being no Google Map API key set or set incorrectly. To use the Google Maps JavaScript API, you must register your app project on the Google Cloud Platform Console and get a Google API key which you can add to your app.
From the comments you stated that you built the key from the Release version of the app, but the error message suggests that you were testing locally which would also suggest that you're testing with the debug version of your APK.
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"'
}
}
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" />
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With