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

[Bug] How to resolve colission on kotlin_module file dependencies #673

Open
vegaro opened this issue Feb 15, 2024 · 1 comment
Open

[Bug] How to resolve colission on kotlin_module file dependencies #673

vegaro opened this issue Feb 15, 2024 · 1 comment

Comments

@vegaro
Copy link

vegaro commented Feb 15, 2024

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2021.3.3f1
  • External Dependency Manager version: 1.2.176
  • Source you installed EDM4U: .unitypackage
  • Features in External Dependency Manager in use: Android Resolver
  • Plugins SDK in use: Purchases (https://github.com/RevenueCat/purchases-unity) (RevenueCat)
  • Platform you are using the Unity editor on: Mac

[REQUIRED] Please describe the issue here:

Our Unity plugin has a dependency on an android only library (com.revenuecat.purchases:purchases) that has a dependency on kotlinx-serialization-json. Which itself has a compile dependency on kotlinx-serialization-json-jvm. This is in the pom file of kotlinx-serialization-json.

<dependencies>
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-serialization-json-jvm</artifactId>
<version>1.4.1</version>
<scope>compile</scope>
</dependency>
</dependencies>

The thing is that it looks like both kotlinx-serialization-json-jvm and kotlinx-serialization-json share the same name for their kotlin_module. So when using the regular Android resolver (no mainTemplate.gradle), users of my plugin get this issue:

* What went wrong:
Execution failed for task ':unityLibrary:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 2 files found with path 'META-INF/kotlinx-serialization-json.kotlin_module' from inputs:

I see both files:

  • kotlinx-serialization-json-1.4.1.jar
  • org.jetbrains.kotlinx.kotlinx-serialization-json-jvm-1.4.1.jar

I was wondering if there's something built in the plugin to prevent this. From now I've recommended using mainTemplate.gradle resolution to use standard Maven dependencies or adding:

packagingOptions {
     resources.pickFirsts.add("META-INF/kotlinx-serialization-json.kotlin_module")
}

The fact that the dependency is <scope>compile</scope> in the pom also made me wonder if it is really necessary to download the .jar to compile the project. Isn't the kotlinx-serialization-json-1.4.1.jar already compiled code? Why do we need org.jetbrains.kotlinx.kotlinx-serialization-json-jvm-1.4.1.jar? This is probably me just misunderstanding how dependency resolution works in the context of Android development.

Thanks

@vegaro vegaro added new to be triaged type: question labels Feb 15, 2024
@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@paulinon paulinon removed the new to be triaged label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants