Android Google Api "failed To Load Map"
I'm trying to display Google Map's map. I followed this tutorial. I Fixed some problems and the application runs, but I could not display the map. Here what I did: Created an API
Solution 1:
Inside your application tag (in manifest) add:
<uses-libraryandroid:name="com.google.android.maps" />
Replace your fragment XML by this:
<fragment
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"class="com.google.android.gms.maps.SupportMapFragment"
/>
Let your activity extend FragmentActivity and onCreate and onResume call this code:
intstatus= GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());
if(status == ConnectionResult.SUCCESS){
if (mMap == null) {
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
if (mMap != null) {
UiSettingssettings= mMap.getUiSettings();
settings.setZoomControlsEnabled(true);
settings.setCompassEnabled(true);
settings.setRotateGesturesEnabled(true);
settings.setTiltGesturesEnabled(true);
settings.setScrollGesturesEnabled(true);
settings.setZoomControlsEnabled(true);
settings.setZoomGesturesEnabled(true);
settings.setMyLocationButtonEnabled(false);
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
mMap.setMyLocationEnabled(false);
}
}
}
Don't forget to declare your mMap variable like this:
private GoogleMap mMap;
Solution 2:
Based on nsvir's earlier edit generating a new debug.keystore and a new key solves this problem.
The information in this article was helpful in understanding more about certificates.
Post a Comment for "Android Google Api "failed To Load Map""