Я использую карту Google V2 в своем проекте, я создаю экземпляр карты в классе базового адаптера (настройка в списке),
Файл макета:
<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();
}
}
У меня есть все известные разрешения для карты.
<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" />
Я работаю над этим последние два дня, и все проверил, у меня ничего не получилось..
Логи получаем от Google.
1. I/Google Maps Android API(26592): версия пакета сервисов Google Play: 5089038
2. Не удалось разрешить Lcom/google/android/gms/location/ внутренняя/ParcelableGeofence; интерфейс 4023 'Lglm;'
3. Не удалось найти класс 'com.google.android.gms.location.internal.ParcelableGeofence', на который ссылается метод gls.a
4. Не удалось загрузить карту. Ошибка связи с серверами Google. Вероятно, это проблема аутентификации (но это может быть связано с сетевыми ошибками).
Кто-нибудь может помочь, пожалуйста?