Skip to content

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

Description

@vanniktech

I'm using GoogleMaps as follows:

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions