mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

Crash in MapboxTelemetry : Caused by com.mapbox.common.module.provider.MapboxInvalidModuleException

Open dh-hasif opened this issue 3 years ago • 9 comments

Environment

  • Android OS version: 10 , 11
  • Devices affected: Realme, OPPO, Nubia
  • Maps SDK Version: 10.3.0

Observed behavior and steps to reproduce

We are reporting several crashes in production from some set of users, and the stack trace is as follows

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 ModuleProviderinstance to Mapbox_MapTelemetryModuleConfiguration#setModuleProvider before initializing the library, unlessenableConfiguration flag is set to false and your implementation has a public, non-arg constructor or is a Kotlin object.

com.mapbox.common.module.provider.MapboxModuleProvider.createModule (MapboxModuleProvider.kt:88) com.mapbox.maps.MapController.dispatchTelemetryTurnstileEvent (MapController.kt:214) com.mapbox.maps.MapController.<init> (MapController.kt:77) com.mapbox.maps.MapView.<init> (MapView.kt:101) com.mapbox.maps.MapView.<init> (MapView.kt:69) com.mapbox.maps.MapView.<init> (MapView.kt:63) java.lang.reflect.Constructor.newInstance0 (Constructor.java) java.lang.reflect.Constructor.newInstance (Constructor.java:343) android.view.LayoutInflater.createView (LayoutInflater.java:852) android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:1008) android.view.LayoutInflater.createViewFromTag (LayoutInflater.java:959) android.view.LayoutInflater.rInflate (LayoutInflater.java:1138) android.view.LayoutInflater.rInflateChildren (LayoutInflater.java:1099) android.view.LayoutInflater.inflate (LayoutInflater.java:680) android.view.LayoutInflater.inflate (LayoutInflater.java:532) com.foodora.courier.map.enabled.presentation.MapboxFragment.onCreateView (MapboxFragment.kt:153) androidx.fragment.app.Fragment.performCreateView (Fragment.java:2995) androidx.fragment.app.FragmentStateManager.createView (FragmentStateManager.java:523) androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:261) androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:1840) androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:1758) androidx.fragment.app.FragmentManager.execPendingActions (FragmentManager.java:1701) androidx.fragment.app.FragmentManager.dispatchStateChange (FragmentManager.java:2849) androidx.fragment.app.FragmentManager.dispatchStart (FragmentManager.java:2791) androidx.fragment.app.Fragment.performStart (Fragment.java:3062) androidx.fragment.app.FragmentStateManager.start (FragmentStateManager.java:587) androidx.fragment.app.FragmentStateManager.moveToExpectedState (FragmentStateManager.java:279) androidx.fragment.app.FragmentManager.executeOpsTogether (FragmentManager.java:1840) androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute (FragmentManager.java:1758) androidx.fragment.app.FragmentManager.execSingleAction (FragmentManager.java:1670) androidx.fragment.app.BackStackRecord.commitNowAllowingStateLoss (BackStackRecord.java:323) androidx.fragment.app.FragmentStatePagerAdapter.finishUpdate (FragmentStatePagerAdapter.java:274) androidx.viewpager.widget.ViewPager.populate (ViewPager.java:1244) androidx.viewpager.widget.ViewPager.populate (ViewPager.java:1092) androidx.viewpager.widget.ViewPager.onMeasure (ViewPager.java:1622) android.view.View.measure (View.java:25960) android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7112) android.widget.LinearLayout.measureChildBeforeLayout (LinearLayout.java:1552) android.widget.LinearLayout.measureVertical (LinearLayout.java:842) android.widget.LinearLayout.onMeasure (LinearLayout.java:721) android.view.View.measure (View.java:25960) android.view.ViewGroup.measureChildWithMargins (ViewGroup.java:7112) androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasureChild (CoordinatorLayout.java:760) androidx.coordinatorlayout.widget.CoordinatorLayout.onMeasure (CoordinatorLayout.java:833) android.view.View.measure (View.java:25960)

we are not currently not able to reproduce this in our test device, but this crash is occurring for some set of users in production app and we are receiving events in crashlytics

Expected behavior

MapView should not crash during inflation

dh-hasif avatar Jul 27 '22 08:07 dh-hasif

this crash is spiking for users.

dh-hasif avatar Aug 02 '22 12:08 dh-hasif

this crash is spiking for users.

@dh-hasif have it started spiking after Maps update or with old version?

yunikkk avatar Aug 03 '22 09:08 yunikkk

@yunikkk currently our app points to maps SDK 10.3.0 but I could also see an issue reported on maps SDK 10.6.0 https://github.com/mapbox/mapbox-maps-android/issues/1475

and this crash is spiking for users. Screenshot 2022-08-03 at 12 45 49

and we could see this happening for various devices like OPPO, Realme, Nubia, Huawei.

dh-hasif avatar Aug 03 '22 10:08 dh-hasif

We tried this solution as provided in this comment https://github.com/mapbox/mapbox-maps-android/issues/1475#issuecomment-1210381808. we are setting access_token via ResourceOptionsManager during application load and passing access_token via XML to Mapview.

but the issue is not fixed, we could still see the exception occurring for some users in production in Firebase crashlytics.

currently, the app is pointing to SDK 10.7.0

cc @moritzzzzz

dh-hasif avatar Sep 20 '22 13:09 dh-hasif

@dh-hasif would you be able to test out the recommendations in this comment and see if this resolves the crash? It's possible you're seeing this behavior in production because the Playstore uses this app bundle.

harikhalsa avatar Sep 20 '22 19:09 harikhalsa

@harikhalsa as mentioned in the above comment, this is not the same case in our application, we are not disabling the initialization provider. Even I cross-checked the merged manifest file and I could see all the initialization providers for Mapbox added.

Yes, we were rolling out releases via the app bundle. but this issue came up while we migrated from Mapbox version 9 to 10

dh-hasif avatar Sep 21 '22 13:09 dh-hasif

hi @dh-hasif,

Can you share if the initialization provider has been disabled before? It appears there are cases the initialization provider is not recovered even after re-enabling it. In this case, it can be enabled properly by this solution that @harikhalsa shared above. Based on issues that we've received from users, this crash issue is likely related an issue in App Bundle, some kind of conflict with the app configuration rather than something wrong with the telemetry module.

But noting that the crash you are experiencing only came up after migrating version 9 to 10, we will investigate further if there could be other causes, and share with you as soon as possible.

On the other hand, looking at this comment and the issue description, this crash was reproducible when the app stayed in background for 20-30 mins and back to front. Have you tested to see if the same situation happens on your side? It seems the user resolved the crash by passing the token using xml (way 1 in the v9-v10 migration guide)

One more question: Is your app still on 10.7.0 and experiencing the crash?

jinny-nam avatar Sep 22 '22 09:09 jinny-nam

hi @dh-hasif, we are working to fix this issue in the sdk. I will keep you posted about the updates.

jinny-nam avatar Sep 27 '22 18:09 jinny-nam

hi @dh-hasif, would you be able to implement Maps SDK v10.8.1 and see if it resolves the crash? We've include a change where we optimise the telemetry module's initialisation and we think this may resolve the crash.

jinny-nam avatar Oct 04 '22 12:10 jinny-nam