Description
[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