Describe the bug
I have a library A that uses the java-tracker as a dependency. It's a pure Java project because it needs to be shared with other pure Java projects. That is to say it uses the Gradle java plugin.
I also have an application B that uses the android-tracker as a dependency. This uses the Gradle android-application plugin but otherwise contains a mix of Android libraries and Java libraries.
Both scenarios are valid until you try and use library A in application B as dependency. Gradle then complains that there is a DuplicateClass error.
Duplicate class com.snowplowanalytics. snowplow. tracker. DevicePlatform
found in modules
snowplow-android-tracker- 6. 0. 3. aar -> snowplow-android-tracker- 6. 0. 3- runtime (com.snowplowanalytics: snowplow-android- tracker: 6. 0. 3)
and
snowplow-java-tracker- 2. 1. 0. jar -> snowplow-java-tracker- 2. 1. 0 (com.snowplowanalytics: snowplow- java- tracker: 2. 1. 0)
To Reproduce
- Publish a pure Java library that depends on the Snowplow
java-tracker to your Maven Local repo.
- Configure an Android application to additionally check your Maven Local repo.
repositories {
mavenLocal()
... // Other repos you might need
}
- Add to your Android application a dependency on the library that you published in Step 1.
- Add to your Android application a dependency on the Snowplow
android-tracker.
- Build application.
Expected behaviour
The Android application can be successfully compiled with both the java-tracker and the android-tracker side by side.
Additional context
I originally wanted to use the android-tracker as a dependency to the library I am building (library A) but I cannot import an Android .aar into a project that only depends on Java. The usage of Snowplow in Library A is to send events about Library A independently of whatever application Library A may be embedded in - be that Java or Android.
It looks to me that it is only DevicePlatform (in the Java tracker, in the Android tracker) that causes the issue due to the matching namespace and class name.
I really like the android-tracker compared to the java-tracker as I mainly write Kotlin, but there isn't a way for me to build a pure Java SDK that can depend on the android-tracker at the moment and I realise refactoring the android-tracker to separate Android dependencies into another artefact (perhaps two Kotlin written SDKs called snowplow-core and snowplow-android) is a bit much to ask.
As a quick win would you consider renaming DevicePlatform in the java-tracker? Or moving it to a package that won't cause a collision?
Describe the bug
I have a library A that uses the
java-trackeras a dependency. It's a pure Java project because it needs to be shared with other pure Java projects. That is to say it uses the Gradlejavaplugin.I also have an application B that uses the
android-trackeras a dependency. This uses the Gradleandroid-applicationplugin but otherwise contains a mix of Android libraries and Java libraries.Both scenarios are valid until you try and use library A in application B as dependency. Gradle then complains that there is a DuplicateClass error.
To Reproduce
java-trackerto your Maven Local repo.android-tracker.Expected behaviour
The Android application can be successfully compiled with both the
java-trackerand theandroid-trackerside by side.Additional context
I originally wanted to use the
android-trackeras a dependency to the library I am building (library A) but I cannot import an Android.aarinto a project that only depends on Java. The usage of Snowplow in Library A is to send events about Library A independently of whatever application Library A may be embedded in - be that Java or Android.It looks to me that it is only
DevicePlatform(in the Java tracker, in the Android tracker) that causes the issue due to the matching namespace and class name.I really like the
android-trackercompared to thejava-trackeras I mainly write Kotlin, but there isn't a way for me to build a pure Java SDK that can depend on theandroid-trackerat the moment and I realise refactoring theandroid-trackerto separate Android dependencies into another artefact (perhaps two Kotlin written SDKs calledsnowplow-coreandsnowplow-android) is a bit much to ask.As a quick win would you consider renaming
DevicePlatformin thejava-tracker? Or moving it to a package that won't cause a collision?