mapbox-maps-android
mapbox-maps-android copied to clipboard
Crash through not provided MapTelemetry
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.<init>(MapController.kt:76)
at com.mapbox.maps.MapView.<init>(MapView.kt:104)
at com.mapbox.maps.MapView.<init>(MapView.kt:72)
at com.mapbox.maps.MapView.<init>(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.<init>(Snapshotter.kt:54)```
Actually we don't use any custom MpaTelemetry solution expect of giving the user the oportunity opt outing from telemetry
mapView.attribution.setTelemetryEnabled(false)
private fun AttributionPlugin.setTelemetryEnabled(enabled: Boolean) {
val telemetry = getMapAttributionDelegate()
.telemetry()
telemetry.setUserTelemetryRequestState(enabled)
if (!enabled) {
telemetry.disableTelemetrySession()
}
}
Thank you for reporting this issue! This a bit of strange one, atm I can't fully explain why class lookup is failing. The crash occurs at this line:
- https://github.com/mapbox/mapbox-base-android/blob/d97bdcfe9ac43c2c6a63eb7b7a85456350ccd818/common/src/main/java/com/mapbox/common/module/provider/MapboxModuleProvider.kt#L88
Would you be able to access the logs that occur just before this happens?
- https://github.com/mapbox/mapbox-base-android/blob/d97bdcfe9ac43c2c6a63eb7b7a85456350ccd818/common/src/main/java/com/mapbox/common/module/provider/MapboxModuleProvider.kt#L84
@tobrun Cross posting from slack:
i tried reproducing this issue ,but it is not happening , from Firebase console i could get only this stacktrace.
Sorry, for long time no comment...
Actually we had a change of providing the resourceoptions
The crash only happened if we just had an implementation like:
ResourceOptionsManager.getDefault(context, context.getString(R.string.mapbox_access_token))
we never set it via xml before. It may seems that the ResourceOptionsManager
invalidates the access token after a plenty of time.
After setting the token via xml attribute mapbox_resourcesAccessToken
, the crash doesn't occur anymore
@elcolto Thank you for letting us know! Would you mind if we close the issue? cc @tobrun
@moritzzzzz you should not close the issue. We have it in our app too. If this function is provided it should work as expected, if not it is an issue that must be solved.
@ben-j69 does it mean you're still seeing this crash? Which Maps version are you using? It should be resolved with recent versions.
@yunikkk we are using mapbox 10.10.0 and we are seeing in production :
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 @x50(MapboxModuleType.MapTelemetry). - You've provided a
ModuleProviderinstance 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.