Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins are not compatible with Vulkan #77

Open
Vichy97 opened this issue Dec 13, 2024 · 8 comments
Open

Plugins are not compatible with Vulkan #77

Vichy97 opened this issue Dec 13, 2024 · 8 comments

Comments

@Vichy97
Copy link

Vichy97 commented Dec 13, 2024

MapLibre Android Version

11.7.0

Android SDK Version

Not relevant

Device

Not relevant

What happened?

You are unable to use Vulkan with plugins because they are not using the vulkan version of MapLibre. You will run into duplicate class failures at compilation time

   Duplicate class org.maplibre.android.style.sources.CustomGeometrySource$Companion found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.CustomGeometrySource$GeometryTileRequest found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.CustomGeometrySource$TileID found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.CustomGeometrySource$startThreads$1 found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.CustomGeometrySourceOptions found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.GeoJsonOptions found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.GeoJsonSource found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.GeometryTileProvider found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.ImageSource found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.RasterDemSource found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.RasterDemSource$Companion found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.RasterSource found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.RasterSource$Companion found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.Source found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.TileSet found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.UnknownSource found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)
     Duplicate class org.maplibre.android.style.sources.VectorSource found in modules android-sdk-11.3.0.aar -> android-sdk-11.3.0-runtime (org.maplibre.gl:android-sdk:11.3.0) and android-sdk-vulkan-11.7.0.aar -> android-sdk-vulkan-11.7.0-runtime (org.maplibre.gl:android-sdk-vulkan:11.7.0)

Steps to reproduce

Use the Vulkan version of MapLibre with any of the plugins. I ran into this using the latest version of the scalebar plugin

Renderer

No response

Relevant log output

Additional context

No response

@Vichy97
Copy link
Author

Vichy97 commented Dec 13, 2024

You can workaround this by using

implementation(libs.maplibre.scalebar.get().toString()) {
        exclude(
          group = "org.maplibre.gl",
          module = "android-sdk",
        )
      }

@louwers
Copy link
Collaborator

louwers commented Dec 13, 2024

@Vichy97 I realized this as well yesterday. Thanks for sharing your solution.

I think we simply need to document this. What do you think?

@Vichy97
Copy link
Author

Vichy97 commented Dec 13, 2024

Documenting is definitely a good idea, but I think the best solution would be to make vulkan compatible releases for the plugins (unless the main artifact will definitely be updated to include runtime configuration of vulkan). Also the plugins could probably use an update anyway since the scalebar plugin seems to be using 11.3.0

@sargunv
Copy link

sargunv commented Dec 13, 2024

Feel free to copy from my maplibre-compose documentation:

https://github.com/sargunv/maplibre-compose/blob/b499227df1e8aaf2a25cc172133c48c63d4f9640/docs/docs/getting-started.md?plain=1#L71-L97

@sargunv
Copy link

sargunv commented Dec 13, 2024

I think the best solution would be to make vulkan compatible releases for the plugins

I feel like it makes more sense for the plugins to compileOnly with maplibre-android instead of including maplibre-android in their dependency tree. As far as I know, nothing in the plugin code changes between opengl/vulkan, so it'd be strange to publish three identical versions just defining a different dependency that the dependent app would declare itself anyway.

@louwers louwers transferred this issue from maplibre/maplibre-native Dec 13, 2024
@KiwiKilian
Copy link

KiwiKilian commented Dec 16, 2024

This is also an issue when using the -opengl suffix, if someone wants to lock in the OpenGL variant like this:

implementation "org.maplibre.gl:android-sdk-opengl:11.7.0"

@louwers
Copy link
Collaborator

louwers commented Dec 16, 2024

@KiwiKilian Could you clarify what the issue is?

@KiwiKilian
Copy link

KiwiKilian commented Dec 16, 2024

We have these dependencies in MapLibre React Native:

  implementation "org.maplibre.gl:android-sdk:11.7.0"
  implementation "org.maplibre.gl:android-sdk-turf:6.0.1"

I wanted to change to following, simply adding the -opengl suffix:

  implementation "org.maplibre.gl:android-sdk-opengl:11.7.0"
  implementation "org.maplibre.gl:android-sdk-turf:6.0.1"

But then the same duplicate class errors appear as initially reported. So basically the plugins have a problem with either suffixed flavor.

I know it doesn't matter right now, as 11.7.0 without suffix is OpenGL. But longterm I would like add a choice for RN user, if they want Vulkan or OpenGL, then I would also prefer to use the suffixed versions. Will try the workaround later #77 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants