I'm using Google map V2 in my project, I'm instantiating map in baseadapter class (setting in listview),
Layout file:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<fragment
android:id="@+id/map"
android:name="com.google.android.gms.maps.MapFragment"
android:layout_width="fill_parent"
android:layout_height="500dp"
android:layout_margin="10dp" />
Java code:
private void setUpMap()
{
// Do a null check to confirm that we have not already instantiated the map.
if (ViewHolder.mMap == null)
{
android.app.FragmentManager fm = ((Activity) context).getFragmentManager();
// Try to obtain the map from the SupportMapFragment.
ViewHolder.mMap = ((MapFragment) fm.findFragmentById(R.id.map)).getMap();
//=======clear old marker====
ViewHolder.mMap.clear();
// Check if we were successful in obtaining the map.
if (ViewHolder.mMap != null)
{
ViewHolder.mMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener()
{
@Override
public boolean onMarkerClick(com.google.android.gms.maps.model.Marker marker)
{
marker.showInfoWindow();
return true;
}
});
}
else
Toast.makeText(context, "Unable to create Maps", Toast.LENGTH_SHORT).show();
}
}
I've all the known permission for map.
<permission android:name="com.the.app.rr.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="******_n3wx2Ga-6lBLpD1v56SXs3IIxEqyKw" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
I'm working on it for last two days, and check all, anything didn't work for me..
Logs getting from Google.
1. I/Google Maps Android API(26592): Google Play services package version: 5089038
2. Failed resolving Lcom/google/android/gms/location/internal/ParcelableGeofence; interface 4023 'Lglm;'
3. Could not find class 'com.google.android.gms.location.internal.ParcelableGeofence', referenced from method gls.a
4. Failed to load map. Error contacting Google servers. This is probably an authentication issue (but could be due to network errors).
Can anyone help please?