objectbox / objectbox-java

Android Database - first and fast, lightweight on-device vector database
https://objectbox.io
Apache License 2.0
4.38k stars 302 forks source link

Class conflict with flatbuffers dependency #690

Closed luoyexk closed 4 years ago

luoyexk commented 5 years ago

latest version +--- project :module_mobile | +--- project :lib_common | | +--- io.objectbox:objectbox-kotlin:2.3.4 | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.21 | | | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.21 | | | | --- org.jetbrains:annotations:13.0 | | | --- io.objectbox:objectbox-java:2.3.4 | | | +--- io.objectbox:objectbox-java-api:2.3.4 | | | +--- org.greenrobot:essentials:3.0.0-RC1 | | | +--- com.google.flatbuffers:flatbuffers-java:1.9.0 | | | --- com.google.code.findbugs:jsr305:3.0.2 | | +--- io.objectbox:objectbox-android:2.3.4 | | | --- io.objectbox:objectbox-java:2.3.4 (*)

google arcore lib use flatbuffers, your package name are same, this make conflict

google_sceneform

luoyexk commented 5 years ago

conflict

how can I merge them?

` package io.objectbox.model; import java.nio.; import java.lang.; import java.util.; import com.google.flatbuffers.; @SuppressWarnings("unused") /**

greenrobot-team commented 5 years ago
  1. Apply the ObjectBox plugin after the dependencies block:

    dependencies {
    ...
    }
    apply plugin: 'io.objectbox'
  2. Manually include objectbox-java and exclude its flatbuffers dependency:

    implementation("io.objectbox:objectbox-java:$objectboxVersion") {
    exclude group: 'com.google.flatbuffers', module: 'flatbuffers-java'
    }

    https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:excluding_transitive_module_dependencies

-Uwe

greenrobot-team commented 4 years ago

Since 2.6.0 the objectbox-java library no longer leaks the FlatBuffers dependency, making the above workaround superfluous.