pawan-pk / react-native-mapbox-navigation

Mapbox React Native SDKs enable interactive maps and real-time, traffic-aware turn-by-turn navigation, dynamically adjusting routes to avoid congestion.
MIT License
20 stars 7 forks source link

Error when implementing `@pawan-pk/react-native-mapbox-navigation` with `@rnmapbox/maps` #16

Closed joseptl closed 2 months ago

joseptl commented 2 months ago

Error when implementing @pawan-pk/react-native-mapbox-navigation with @rnmapbox/maps

Library Versions:

Description: I tried to implement the navigation component in a project where I was already using @rnmapbox/maps, and I'm encountering the following errors:

Invariant Violation: Tried to register two views with the same name RNMBXImageSource, js engine: hermes
Exception in HostObject::get for prop 'RNMBXLocationModule': java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapbox/android/core/location/LocationEngineCallback;, js engine: hermes

I suspect the issue arises because both libraries are using the same views. When I remove @pawan-pk/react-native-mapbox-navigation, @rnmapbox/maps starts working, and vice versa.

I would like to know how I can resolve this conflict.

jacquesngomeheffa commented 2 months ago

@joseptl I have encountered this issue before This Mapbox version will work "RNMapboxMapsVersion": "10.17.0"

joseptl commented 2 months ago

@joseptl I have encountered this issue before This Mapbox version will work "RNMapboxMapsVersion": "10.17.0"

I added that version of Mapbox to the "@rnmapbox/maps" plugin, but the error still appears. When you solved this issue, did you also assign that version of Mapbox to the @pawan-pk/react-native-mapbox-navigation library? If so, how can I do that?

jacquesngomeheffa commented 2 months ago

Check this out. This is how I have done it

12

https://github.com/pawan-pk/react-native-mapbox-navigation/issues/12#issuecomment-2309303069

zuberpurahoomns commented 2 months ago

@joseptl Encountered the same error yesterday. When I used mapbox v11 instead of default v10 for @rnmapbox/maps, it works. This package is using navigation sdk v3 which depends on mapbox core v11. There is a dependency issue.

Hope this helps you.

pawan-pk commented 2 months ago

@joseptl Have you resolved these issues?