realm / realm-java

Realm is a mobile database: a replacement for SQLite & ORMs
http://realm.io
Apache License 2.0
11.45k stars 1.75k forks source link

Is that conflict between Realm and firebase-inapmessaging-display ?? #6202

Closed Thien658jjh closed 5 years ago

Thien658jjh commented 5 years ago

I am using Realm in my app but not RxJava2, so I created 3 empty classes in java/io/reactivex

enum BackpressureStrategy
class Flowable
class Observable

It worked perfectly till I added firebase-inapmessaging-display It throws me this error: Program type already present: io.reactivex.Flowable I tried to exclude io.reactivex.Flowable :

    implementation ('com.google.firebase:firebase-inappmessaging-display:17.0.1') {
        exclude group:   'io.reactivex.Flowable'
        /// Or event  eclude module: "rxjava"  == > they gave me: FirebaseInstanceId: Google Play services missing or without correct permission.
 }

So what can I do to fix it ?

cmelchior commented 5 years ago

You cannot exclude a single class like that. You will need to exclude the whole of RxJava from firebase-in-app messaging-display in that case.

 implementation ('com.google.firebase:firebase-inappmessaging-display:17.0.1') {
        exclude group:   'io.reactivex.rxjava2'
}

But I don't know if firebase-inappmessaging-display has a dependency on RxJava2, so maybe something else is pulling it in.

You can see where dependencies come from by using ./gradlew dependencies from the commandline at the root of your project.

Thien658jjh commented 5 years ago

You cannot exclude a single class like that. You will need to exclude the whole of RxJava from firebase-in-app messaging-display in that case.

 implementation ('com.google.firebase:firebase-inappmessaging-display:17.0.1') {
        exclude group:   'io.reactivex.rxjava2'
}

But I don't know if firebase-inappmessaging-display has a dependency on RxJava2, so maybe something else is pulling it in.

You can see where dependencies come from by using ./gradlew dependencies from the commandline at the root of your project.

Yes I did. After ./gradlew dependencies , I saw that firebase-inappmessaging-display also using RxJava2, so I thought that It's the problem came from

cmelchior commented 5 years ago

In that case using:

 implementation ('com.google.firebase:firebase-inappmessaging-display:17.0.1') {
        exclude group:   'io.reactivex.rxjava2'
}

Should remove rxjava2 (but I don't know if that will break firebase)

Zhuinden commented 5 years ago

Actually, you should just remove your empty classes, if you transitively bring in Rx2 anyway

cmelchior commented 5 years ago

Yup, if Firebase requires RxJava2, that is the only way forward.

Thien658jjh commented 5 years ago

ok, thank you

samtstern commented 5 years ago

firebase-inappmessaging-display depends on firebase-inappmessaging which depends on RXJava2, so there's no way to just "exclude" that and have things keep working:

curl https://dl.google.com/dl/android/maven2/com/google/firebase/firebase-inappmessaging/17.0.0/firebase-inappmessaging-17.0.0.pom
<?xml version='1.0' encoding='UTF-8'?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.google.firebase</groupId>
  <artifactId>firebase-inappmessaging</artifactId>
  <version>17.0.0</version>
  <packaging>aar</packaging>
  <dependencies>
    <dependency>
      <groupId>com.google.android.gms</groupId>
      <artifactId>play-services-clearcut</artifactId>
      <version>15.0.1</version>
      <scope></scope>
      <type>aar</type>
    </dependency>
    <dependency>
      <groupId>com.google.auto.value</groupId>
      <artifactId>auto-value-annotations</artifactId>
      <version>1.6</version>
      <scope></scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>com.google.dagger</groupId>
      <artifactId>dagger</artifactId>
      <version>2.13</version>
      <scope></scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>com.google.firebase</groupId>
      <artifactId>firebase-common</artifactId>
      <version>16.0.1</version>
      <scope></scope>
      <type>aar</type>
    </dependency>
    <dependency>
      <groupId>com.google.firebase</groupId>
      <artifactId>firebase-iid</artifactId>
      <version>16.0.0</version>
      <scope></scope>
      <type>aar</type>
    </dependency>
    <dependency>
      <groupId>com.google.firebase</groupId>
      <artifactId>firebase-measurement-connector</artifactId>
      <version>17.0.0</version>
      <scope></scope>
      <type>aar</type>
    </dependency>
    <dependency>
      <groupId>com.google.firebase</groupId>
      <artifactId>protolite-well-known-types</artifactId>
      <version>16.0.0</version>
      <scope></scope>
      <type>aar</type>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-okhttp</artifactId>
      <version>1.12.0</version>
      <scope></scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-protobuf-lite</artifactId>
      <version>1.12.0</version>
      <scope></scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-stub</artifactId>
      <version>1.12.0</version>
      <scope></scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>io.reactivex.rxjava2</groupId>
      <artifactId>rxandroid</artifactId>
      <version>2.0.2</version>
      <scope></scope>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>io.reactivex.rxjava2</groupId>
      <artifactId>rxjava</artifactId>
      <version>2.1.14</version>
      <scope></scope>
      <type>jar</type>
    </dependency>
  </dependencies>
  <name>firebase-inappmessaging</name>
  <licenses>
    <license>
      <name>Android Software Development Kit License</name>
      <url>https://developer.android.com/studio/terms.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
</project>
Zhuinden commented 5 years ago

Then don't exclude RxJava2