Код: Выделить всё
missed interaction because MapUe3Logger was not yet initialized ebe
at ebg.b(:com.google.android.gms.policy_maps_core_dynamite@221110601@221110601072.437244185.437244185:0)
at czr.run(:com.google.android.gms.policy_maps_core_dynamite@221110601@221110601072.437244185.437244185:5)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Код: Выделить всё
public class MapsFragment extends Fragment {
private final OnMapReadyCallback callback = googleMap -> {
showTripPaths(googleMap);
googleMap.setInfoWindowAdapter(new CustomInfoWindowAdapter());
googleMap.setOnMarkerClickListener(this::markerClickListener);
};
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater,
@Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_maps, container, false);
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SupportMapFragment mapFragment =
(SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.map);
if (mapFragment != null) {
mapFragment.getMapAsync(callback);
}
mapsViewModel =
new ViewModelProvider(this).get(MapsViewModel.class);
}
private boolean markerClickListener(Marker m) {
if (m.isInfoWindowShown()) {
m.hideInfoWindow();
} else {
m.showInfoWindow();
}
return true;
}
private void showTripPaths(GoogleMap googleMap) {
// put markers on map
}
class CustomInfoWindowAdapter implements InfoWindowAdapter {
private final View contents;
CustomInfoWindowAdapter() {
contents = getLayoutInflater().inflate(R.layout.custom_info_contents, null);
}
@Override
public View getInfoWindow(@NonNull Marker marker) {
return null;
}
@Override
public View getInfoContents(@NonNull Marker marker) {
render(marker, contents);
return contents;
}
private void render(Marker marker, View view) {
TextView titleTextView = view.findViewById(R.id.title);
TextView snippetTextView = view.findViewById(R.id.snippet);
ImageView tripPhotoView = view.findViewById(R.id.tripImage);
Button showTripButton = view.findViewById(R.id.showTripButton);
// setting text
}
}
Код: Выделить всё
Код: Выделить всё
plugins {
id("com.android.application")
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
}
//...
dependencies {
//...
implementation("com.google.android.gms:play-services-maps:18.2.0")
implementation("com.google.android.gms:play-services-location:21.2.0")
implementation("com.google.android.gms:play-services-places:17.0.0")
implementation("com.google.android.libraries.places:places:3.4.0")
implementation("com.google.android.material:material:1.11.0")
implementation("com.google.android.gms:play-services-base:18.3.0")
implementation("com.google.android.libraries.identity.googleid:googleid:1.1.0")
implementation("com.google.android.gms:play-services-maps:18.2.0")
}
Как я могу решить эту проблему?
Подробнее здесь: https://stackoverflow.com/questions/784 ... d-when-try
Мобильная версия