googlemaps / googlemaps/android-maps-compose

Google Map Compose laggy Skipped 32 frames! The application may be doing too much work on its main thread.

Open
#664 7 comments 7 reactions 0 assignees View on GitHub
priority: p2 type: bug
Dominant language
Kotlin
Stars
1.3k
Forks
181
Avg merge
2d 23h
Merged PRs (30d)
18

Description

I'm using GoogleMaps as follows:

```kotlin
Box {
val mapUiSettings by remember {
mutableStateOf(
MapUiSettings(
mapToolbarEnabled = false,
myLocationButtonEnabled = false, // We don't want that button.
zoomControlsEnabled = false,
),
)
}

val cameraPositionState = rememberCameraPositionState()

GoogleMap(
properties = MapProperties(isMyLocationEnabled = isMyLocationEnabled),
modifier = modifier,
cameraPositionState = cameraPositionState,
uiSettings = mapUiSettings,
mapColorScheme = ComposeMapColorScheme.FOLLOW_SYSTEM,
)

ScaleBar(
modifier = Modifier
.padding(top = 5.dp, end = 15.dp)
.align(Alignment.TopEnd),
cameraPositionState = cameraPositionState,
textColor = MaterialTheme.colorScheme.onBackground,
lineColor = MaterialTheme.colorScheme.onBackground,
shadowColor = Color.Transparent,
)

}
```

The problem is that there seems to be going to much going on since in Logcat I can see:

> Skipped 32 frames! The application may be doing too much work on its main thread.

Now this is just a super simple map that is displayed with the following Modifier: `Modifier.fillMaxWidth().aspectRatio(1f)`

Is there any trick to speed it up or am I doing something wrong? I'm already on the last 6.4.0 version.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.