Hi, I’m looking to implement MapLibre (10.2.0) for...
# multiplatform
c
Hi, I’m looking to implement MapLibre (10.2.0) for android and UIMapKit for iOS in a Compose Multiplatform project. Good news, both maps work and I’m able to even implement an initial camera position. The bad news start when I try to add markers to MapLibre. I found out I would need to install an extension plugin, luckily I found it : “com.mapbox.mapboxsdkmapbox android plugin annotation v90.9.0” However, whenever i try to run the app after all gradle builds suceed, I get these error message and really not sure what to do next:
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':composeApp:checkDebugDuplicateClasses'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:148).....
Caused by: java.lang.RuntimeException: Duplicate class com.mapbox.geojson.BaseCoordinatesTypeAdapter found in modules android-sdk-geojson-5.9.0 (<http://org.maplibre.gl:android-sdk-geojson:5.9.0|org.maplibre.gl:android-sdk-geojson:5.9.0>) and mapbox-sdk-geojson-5.0 (com.mapbox.mapboxsdk:mapbox-sdk-geojson:5.0.0)
Duplicate class com.mapbox.geojson.BaseGeometryTypeAdapter found in modules android-sdk-geojson-5.9.0 (<http://org.maplibre.gl:android-sdk-geojson:5.9.0|org.maplibre.gl:android-sdk-geojson:5.9.0>) and mapbox-sdk-geojson-5.0 (com.mapbox.mapboxsdk:mapbox-sdk-geojson:5.0.0)
Duplicate class com.mapbox.geojson.BoundingBox found in modules android-sdk-geojson-5.9.0 (<http://org.maplibre.gl:android-sdk-geojson:5.9.0|org.maplibre.gl:android-sdk-geojson:5.9.0>) and mapbox-sdk-geojson-5.0 (com.mapbox.mapboxsdk:mapbox-sdk-geojson:5.0.0)
Duplicate class com.mapbox.geojson.CoordinateContainer found in modules android-sdk-geojson-5.9.0 (<http://org.maplibre.gl:android-sdk-geojson:5.9.0|org.maplibre.gl:android-sdk-geojson:5.9.0>) and mapbox-sdk-geojson-5.0 (com.mapbox.mapboxsdk:mapbox-sdk-geojson:5.0.0)
Duplicate class com.mapbox.geojson.Feature found in modules android-sdk-geojson-5.9.0 (<http://org.maplibre.gl:android-sdk-geojson:5.9.0|org.maplibre.gl:android-sdk-geojson:5.9.0>) and mapbox-sdk-geojson-5.0 (com.mapbox.mapboxsdk:mapbox-sdk-geojson:5.0.0)
Duplicate class com.mapbox.g….
🧵 2
m
Both org.maplibre.gl:android-sdk-geojson:5.9.0 and com.mapbox.mapboxsdkmapbox sdk geojson5.0.0 use the same name for some classes. Try using only the plugin. Otherwise, you will have to attempt to exclude dependencies from those two.
e
Hi @Cheick Kante, were you able to get this issue resolved? I’m just getting started with MapLibre on KMP, and I’m curious to see what problems you encountered.
c
I did solve my issue. I can fully use (display map, add markers..) MapLibre on Android with their latest release v11.0.0 For some context, my goal was to use MapLibre on Android and MapKit on iOS. ~ MapLibre, which was a fork of MapBox, is a new community project. Some package names were not updated (from mapbox, com.mapbox.* to maplibre, org.maplibre.*), specifically the ones for plugins. The latest version of maplibre and its plugins are safe to use on android since 2 weeks ago
e
Thanks. It looks like the biggest change in v11.0.0 is renaming the packages to be org.maplibre. Got the Android side of MapLibre working now. Trying to get the iOS version to compile and link. My eventual goal is to have a KMP-friendly library for MapLibre on both platforms.
c
I haven't personally tried Maplibre on iOS, I went with Apple Map since it's already built-in you have access to the MKMapKit library on iOS side, and you can also use Tile overlay to make your app looks the same on both platforms instead of their default appearance.