question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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'
    })

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
jakettcommented, Nov 21, 2019

With this library, please use “com.google.firebase:firebase-firestore:15.0.0”

If you want to use firestore with higher version, you can use command: “gradlew app: androidDependencies” to identify child components in firestore, and only implement necessary components.

1reaction
ejona86commented, Apr 5, 2019

You’ll want a builtins { remove java }. We do some of this is grpc, but don’t look at it too much because we do a lot of complex things 😃. But the generateProtoTasks seen there is about what yours should look like.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conflict issue with com.google.protobuf:protobuf-java and ...
Android Gradle conflict with Google firebase-firestore : protobuf-lite nested dependency. Describe the bug I am attempting to test Capillary in ...
Read more >
Gradle 'exclude' troubleshooting: nested dependencies on ...
I am using Google Firebase-Firestore DB, which implements grpc and uses nested dependency: com.google.protobuf:protobuf-lite:3.0.1.
Read more >
Android studio gradle error - Help/Discuss
In the Jumble module, I'm using protobuf-java library and in the app module I'm using FirebaseFirestore that includes internally a protobuf-lite ...
Read more >
Usage and limits | Firestore - Firebase
On this page · Monitor your usage. Detailed usage in the Google Cloud Console · Free quota · Standard limits. Collections, documents, and...
Read more >
Firestore conflict. - Google Groups
But after I compile the dependency i have a RunTime error: ... mavenLocal() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0' classpath ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found