S
S
Sergey Zolotarev2021-11-21 11:05:13
Java
Sergey Zolotarev, 2021-11-21 11:05:13

How to get rid of duplicate classes when installing and building the Mapbox SDK?

I recently ran into a big problem when downloading and unpacking the Mapbox SDK for Android:

Duplicate class com.mapbox.mapboxsdk.maps.Style$Builder$LayerBelowWrapper found in modules jetified-android-sdk-9.2.1-runtime (org.maplibre.gl:android-sdk:9.2.1) and jetified-mapbox-android-sdk-9.6.1-runtime (com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.1)
     Duplicate class com.mapbox.mapboxsdk.maps.Style$Builder$LayerWrapper found in modules jetified-android-sdk-9.2.1-runtime (org.maplibre.gl:android-sdk:9.2.1) and jetified-mapbox-android-sdk-9.6.1-runtime (com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.1)
     Duplicate class com.mapbox.mapboxsdk.maps.Style$OnStyleLoaded found in modules jetified-android-sdk-9.2.1-runtime (org.maplibre.gl:android-sdk:9.2.1) and jetified-mapbox-android-sdk-9.6.1-runtime (com.mapbox.mapboxsdk:mapbox-android-sdk:9.6.1)

This is an excerpt from a list of duplicate class errors that were made when unpacking the Mapbox SDK for Android in my application project. My project stack consists of React Native with Typescript logic and the Expo SDK and ExpoKit cross-platform tool.

If you faced this problem, how did you solve it?

Configuration and code examples in the comments to this question and thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BorLaze, 2021-11-21
@BorLaze

In maven, such collisions are solved like this:

<dependencies>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${slf4j-api.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.storm</groupId>
        <artifactId>storm-core</artifactId>
        <version>${storm.version}</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
</dependencies>

That is, in the event of a conflict, you explicitly indicate which package to leave, and where to exclude it from.
I think there is a similar tool in gradle for sure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question