mapbox / mapbox/mapbox-maps-android

Crash through not provided MapTelemetry

Open
#1,475 11 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle: needs info
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version: 8 - 12
- Devices affected: several, for example Pixel 4a
- Maps SDK Version: 10.6

## Observed behavior and steps to reproduce

SDK crashes, when implementing App lies in the background for a plenty of time (~20 min) and is pulled back to front. When a View with a MapBoxMap is started, a crash occurs with following Stacktrace:

```
Caused by com.mapbox.common.module.provider.MapboxInvalidModuleException: MapTelemetry has been excluded from build but a correct alternative was not provided.
Make sure that:
- Your custom module implements com.mapbox.maps.module.MapTelemetry.
- Your custom module class is annotated with @a(b.MapTelemetry).
- You've provided a `ModuleProvider` instance to Mapbox_MapTelemetryModuleConfiguration#setModuleProvider before initializing the library,
unless `enableConfiguration` flag is set to false and your implementation has a public, non-arg constructor or is a Kotlin object.
at com.mapbox.common.module.provider.MapboxModuleProvider.createModule(MapboxModuleProvider.kt:88)
at com.mapbox.maps.MapController.dispatchTelemetryTurnstileEvent(MapController.kt:222)
at com.mapbox.maps.MapController.(MapController.kt:76)
at com.mapbox.maps.MapView.(MapView.kt:104)
at com.mapbox.maps.MapView.(MapView.kt:72)
at com.mapbox.maps.MapView.(MapView.kt:66)
at java.lang.reflect.Constructor.newInstance0(Constructor.java)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:858)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1010)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
at android.view.LayoutInflater.inflate(LayoutInflater.java:660)
at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
at android.view.LayoutInflater.inflate(LayoutInflater.java:485)
at my.package.databinding.LayoutCustomMapboxMapViewBinding.inflate(LayoutCustomMapboxMapViewBinding.java:50)
```

Same happens when a Snapshotter is used:

```
Non-fatal Exception: com.mapbox.common.module.provider.MapboxInvalidModuleException: MapTelemetry has been excluded from build but a correct alternative was not provided.
Make sure that:
- Your custom module implements com.mapbox.maps.module.MapTelemetry.
- Your custom module class is annotated with @a(b.MapTelemetry).
- You've provided a `ModuleProvider` instance to Mapbox_MapTelemetryModuleConfiguration#setModuleProvider before initializing the library,
unless `enableConfiguration` flag is set to false and your implementation has a public, non-arg constructor or is a Kotlin object.
at com.mapbox.common.module.provider.MapboxModuleProvider.createModule(MapboxModuleProvider.kt:88)
at com.mapbox.maps.Snapshotter.dispatchTelemetryTurnstileEvent(Snapshotter.kt:94)
at com.mapbox.maps.Snapshotter.(Snapshotter.kt:54)```
```

Actually we don't use any custom MpaTelemetry solution expect of giving the user the oportunity opt outing from telemetry

```kotlin
mapView.attribution.setTelemetryEnabled(false)

private fun AttributionPlugin.setTelemetryEnabled(enabled: Boolean) {
val telemetry = getMapAttributionDelegate()
.telemetry()

telemetry.setUserTelemetryRequestState(enabled)
if (!enabled) {
telemetry.disableTelemetrySession()
}
}

```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MapController and Snapshotter initialization paths named in the stack traces, focusing on MapTelemetry creation after the app returns from the background. Reproduce the MapView and Snapshotter cases on the listed Android versions with telemetry disabled. Done means neither path throws MapboxInvalidModuleException when no custom MapTelemetry implementation is supplied.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.