Whenever I exit the activity that holds the Mapbox map, the application crashes and this error message appears in my log:
W/mbgl-locationSymbol: Style is not fully loaded, not able to get source!
This is what my @onDestroy looks like:
@Override
protected void onDestroy() {
super.onDestroy();
if (mapboxMap != null) {
mapView.onDestroy();
}
}
Adding the following code to onDestroy resolved this issue:
@Override
protected void onDestroy() {
super.onDestroy();
if (mapboxMap != null) {
mapboxMap.removeOnMapClickListener(this);
mapView.removeOnDidFinishLoadingStyleListener(this::onDestroy);
mapView.onStop();
}
mapView.onDestroy();
}