Skip to content

Android Gradle conflict with Google firebase-firestore: protobuf-lite nested dependency #11

@junkomatic

Description

@junkomatic

Describe the bug
I am attempting to test Capillary in a simple Android app (on device), but during the gradle build process I am getting "Error: Program type already present: com.google.protobuf.AnyProto" (or other classes).

I am using Google Firebase-Firestore DB, which implements grpc and uses nested dependency: com.google.protobuf:protobuf-lite:3.0.1.

Also, the google/Capillary library uses nested dependency: com.google.protobuf:protobuf-java:3.4.0.

If I exclude com.google.protobuf from the Capillary lib dependency only, the app will run, then crash when RSAKeyManager is instantiated, with error: "java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/protobuf/GeneratedMessageV3;" (I will not be implementing any direct client -> capillary service grpc, as both will have access to Firestore DB, and the capillary service will not be exposed to ingress)

To Reproduce
I assume that adding google/Firestore dependencies to the demo/Android app will also cause this build error. It will sync/build in Android Studio, but build error occurs only when the app is run.

Expected behavior
Through some form of gradle dependency exclusions, will I be able to get these packages to run in the same Android app?

Screenshots
Screenshot from 2019-04-04 12-45-50

I have tried using several combinations of package exclusions, including fully excluding com.google.protobuf from both Firestore and Capillary and implementing either separately:


    implementation('com.google.protobuf:protobuf-java:3.4.0')
    //{OR}
    //implementation('com.google.protobuf:protobuf-lite:3.0.1')

    implementation('com.google.firebase:firebase-firestore:18.2.0', {
        exclude group: 'com.google.protobuf', module: 'protobuf-lite'
    })


    implementation('com.google.capillary:lib-android:1.0.0', {
        exclude group: 'com.google.protobuf', module: 'protobuf-java'
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions