You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
duplicate class com.google.protobuf.DescriptorProtos #5997
Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:
For general technical questions, post a question on StackOverflow
with the firebase tag.
For general Firebase discussion, use the firebase-talk
google group.
For help troubleshooting your application that does not fall under one
of the above categories, reach out to the personalized Firebase support channel.
protolite-well-known-types:18.0.0 contains "com.google.protobuf.DescriptorProtos", the same class as protobuf-javalite:4.27.0, resulting in the CheckDuplicatesRunnable failing:
Duplicate class com.google.protobuf.DescriptorProtos found in modules protobuf-javalite-4.27.0.jar -> protobuf-javalite-4.27.0 (com.google.protobuf:protobuf-javalite:4.27.0) and protolite-well-known-types-18.0.0.aar -> protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0)
Steps to reproduce:
try building an app with libraries above
What happened? How can we make the problem occur?
This could be a description, log/console output, etc.
Relevant Code:
// TODO(you): code here to reproduce the problem
Reacted by Edric Chan, Henning Lund, Andrii Chubko, Nouralhorany, IhorʼOk, Jérôme Gully, Yuri Schimke, marcin-adamczewski, Tomasz, Yuval Gnessin and 33 more
Hi @dpredovic, thank you for reaching. Firebase uses protolite that includes the protolite-well-known-types module. To resolve the issue, you have to exclude the protolite-well-known-types module from the Firebase products.
That said, I’ll go ahead and close this issue. Let me know if there’s any misunderstanding and/or we need to re-open the issue for further investigation.
Excluding the library fixes the build error, but leads to missing class at runtime:
java.lang.RuntimeException: Internal error in Cloud Firestore (25.0.0).
at com.google.firebase.firestore.util.AsyncQueue.lambda$panic$3(AsyncQueue.java:545)
at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda3.run(D8$$SyntheticClass:0)
at android.os.Handler.handleCallback(Handler.java:958)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:205)
at android.os.Looper.loop(Looper.java:294)
at android.app.ActivityThread.main(ActivityThread.java:8177)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:552)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:971)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/type/LatLng;
at com.google.firestore.v1.Value.dynamicMethod(Value.java:1806)
at com.google.protobuf.GeneratedMessageLite.dynamicMethod(GeneratedMessageLite.java:290)
at com.google.protobuf.GeneratedMessageLite.buildMessageInfo(GeneratedMessageLite.java:360)
at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:37)
at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:126)
at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:33)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:68)
at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:82)
at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:203)
at com.google.protobuf.GeneratedMessageLite$Builder.buildPartial(GeneratedMessageLite.java:484)
at com.google.protobuf.GeneratedMessageLite$Builder.build(GeneratedMessageLite.java:490)
at com.google.firebase.firestore.model.ObjectValue.<init>(ObjectValue.java:60)
at com.google.firebase.firestore.model.MutableDocument.newInvalidDocument(MutableDocument.java:94)
at com.google.firebase.firestore.local.SQLiteRemoteDocumentCache.getAll(SQLiteRemoteDocumentCache.java:128)
at com.google.firebase.firestore.local.SQLiteRemoteDocumentCache.get(SQLiteRemoteDocumentCache.java:116)
at com.google.firebase.firestore.local.LocalDocumentsView.getBaseDocument(LocalDocumentsView.java:413)
at com.google.firebase.firestore.local.LocalDocumentsView.getDocument(LocalDocumentsView.java:92)
at com.google.firebase.firestore.local.LocalDocumentsView.getDocumentsMatchingDocumentQuery(LocalDocumentsView.java:292)
at com.google.firebase.firestore.local.LocalDocumentsView.getDocumentsMatchingQuery(LocalDocumentsView.java:268)
at com.google.firebase.firestore.local.QueryEngine.executeFullCollectionScan(QueryEngine.java:307)
at com.google.firebase.firestore.local.QueryEngine.getDocumentsMatchingQuery(QueryEngine.java:112)
at com.google.firebase.firestore.local.LocalStore.executeQuery(LocalStore.java:866)
at com.google.firebase.firestore.core.SyncEngine.initializeViewAndComputeSnapshot(SyncEngine.java:223)
at com.google.firebase.firestore.core.SyncEngine.listen(SyncEngine.java:210)
at com.google.firebase.firestore.core.EventManager.addQueryListener(EventManager.java:142)
at com.google.firebase.firestore.core.FirestoreClient.lambda$listen$7$com-google-firebase-firestore-core-FirestoreClient(FirestoreClient.java:181)
at com.google.firebase.firestore.core.FirestoreClient$$ExternalSyntheticLambda15.run(D8$$SyntheticClass:0)
at com.google.firebase.firestore.util.AsyncQueue.lambda$enqueue$2(AsyncQueue.java:444)
at com.google.firebase.firestore.util.AsyncQueue$$ExternalSyntheticLambda4.call(D8$$SyntheticClass:0)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor.lambda$executeAndReportResult$1(AsyncQueue.java:330)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$$ExternalSyntheticLambda2.run(D8$$SyntheticClass:0)
```
Apologies about that. Per checking, the issue occurs in version protobuf-javalite:4.27.0. Based on Maven Protocol Buffers [Lite] Repository, 4.27.0 seems to be in beta version.
I tried using the protobuf-javalite:4.26.1 and I did not encounter build and/ or runtime issues. Aside from that, even not excluding the protolite-well-known-types from Firebase Firestore dependency, build and/ or runtime issues.
Here’s my update dependencies: app/build.gradle.kts
🚨 A word of caution regarding the solution from @ayushi-sk: Removing com.google.firebase:protolite-well-known-types can lead to app crashes. This library provides a crucial communication layer between Firebase and Google's servers. If you apply this fix, you must thoroughly test all Firebase features in your app to ensure they don't cause crashes or unexpected behavior.
Reacted by Adam Essenmacher, Mehdi Yari and Zen Kun
I don't see any safe solution for now (excluding options that could cause runtime crashes or using a new version that would cause build-time errors). It's better to use a version that is compatible with both of these libraries.
I'm using these two, and they are working fine together.
Is there an update on this? Adding protobuf is breaking firestore for us and if exclusion for protolite-well-known-types is not done then the project won't compile due to duplicate class errors.
System.err java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/type/LatLng;
System.err at com.google.firestore.v1.Value.dynamicMethod(Value.java:2696)
System.err at com.google.protobuf.GeneratedMessageLite.buildMessageInfo(GeneratedMessageLite.java:358)
System.err at com.google.protobuf.GeneratedMessageInfoFactory.messageInfoFor(GeneratedMessageInfoFactory.java:37)
System.err at com.google.protobuf.ManifestSchemaFactory$CompositeMessageInfoFactory.messageInfoFor(ManifestSchemaFactory.java:106)
System.err at com.google.protobuf.ManifestSchemaFactory.createSchema(ManifestSchemaFactory.java:33)
System.err at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:54)
System.err at com.google.protobuf.Protobuf.schemaFor(Protobuf.java:69)
System.err at com.google.protobuf.GeneratedMessageLite.makeImmutable(GeneratedMessageLite.java:209)
System.err at com.google.protobuf.GeneratedMessageLite$Builder.buildPartial(GeneratedMessageLite.java:482)
System.err at com.google.protobuf.GeneratedMessageLite$Builder.build(GeneratedMessageLite.java:488)
System.err at com.google.firebase.firestore.model.Values.<clinit>(Values.kt:39)
System.err at com.google.firebase.firestore.model.Values.encodeAnyValue(Values.kt:718)
System.err at com.google.firebase.firestore.UserDataReader.parseScalarValue(UserDataReader.java:406)
System.err at com.google.firebase.firestore.UserDataReader.parseData(UserDataReader.java:282)
System.err at com.google.firebase.firestore.UserDataReader.parseList(UserDataReader.java:314)
System.err at com.google.firebase.firestore.UserDataReader.parseData(UserDataReader.java:280)
System.err at com.google.firebase.firestore.UserDataReader.convertAndParseFieldData(UserDataReader.java:217)
System.err at com.google.firebase.firestore.UserDataReader.parseQueryValue(UserDataReader.java:206)
System.err at com.google.firebase.firestore.Query.parseFieldFilter(Query.java:448)
System.err at com.google.firebase.firestore.Query.parseFilter(Query.java:485)
System.err at com.google.firebase.firestore.Query.where(Query.java:400)
System.err at com.google.firebase.firestore.Query.whereArrayContainsAny(Query.java:297)
System.err Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.type.LatLng" on path: DexPathList[[zip file "/data/app/~~mdJkp1BNNA8krqk7Uk7Geg==/com.sample.app
I've tried the below configuration, and it worked!
To avoid conflicts with protobuf-javalite and protolite-well-known-types, explicitly exclude them from both the Firebase BoM and firebase-perf dependencies.
Additionally, the ProGuard rule ensures that fields in classes extending GeneratedMessageLite are retained, preventing runtime issues caused by code shrinking.
-keepclassmembers class * extends com.google.protobuf.GeneratedMessageLite {
<fields>;
}
Update: Firebase Android BoM version 35.0.0 (released October 07, 2026) includes #8580 which upgrades the gRPC and protobuf dependencies to their latest versions. This may fix the problems reported in this issue. Please try upgrading and report your findings.
Reacted by mangano-ito, Umair, Yuki, Olivier Jouvenaux and Orcun
28. Update: Firebase Android BoM version 35.0.0 (released October 07, 2026) includes #8580 which upgrades the gRPC and protobuf dependencies to their latest versions. This may fix the problems reported in this issue. Please try upgrading and report your findings.
I've been stuck with protobuf-javalite = "4.26.1" because anything more recent gave me "duplicate class" error.
Firebase BoM 35.0.0 solved the issue, at least for me. Curious to know how it works for others.
Activity
lehcar09 commentedon May 24, 2024
Hi @dpredovic, thank you for reaching. Firebase uses protolite that includes the protolite-well-known-types module. To resolve the issue, you have to exclude the
protolite-well-known-typesmodule from the Firebase products.app/build.gradle.kts
That said, I’ll go ahead and close this issue. Let me know if there’s any misunderstanding and/or we need to re-open the issue for further investigation.
dpredovic commentedon May 24, 2024
Excluding the library fixes the build error, but leads to missing class at runtime:
lehcar09 commentedon May 24, 2024
Apologies about that. Per checking, the issue occurs in version
protobuf-javalite:4.27.0. Based on Maven Protocol Buffers [Lite] Repository, 4.27.0 seems to be in beta version.I tried using the
protobuf-javalite:4.26.1and I did not encounter build and/ or runtime issues. Aside from that, even not excluding theprotolite-well-known-typesfrom Firebase Firestore dependency, build and/ or runtime issues.Here’s my update dependencies:
app/build.gradle.kts
Could you check if that works with you as well?
dpredovic commentedon May 24, 2024
The old protobuf version works, no problem. I already downgraded, but we need a better solution.
lehcar09 commentedon May 28, 2024
Thank you for your confirmation. I'll notify our engineers about this issue and see what we can do here.
In the meantime, I suggest using the version protobuf-javalite: 4.26.1.
37 remaining items
jacek-marchwicki commentedon Sep 29, 2025
🚨 A word of caution regarding the solution from @ayushi-sk: Removing
com.google.firebase:protolite-well-known-typescan lead to app crashes. This library provides a crucial communication layer between Firebase and Google's servers. If you apply this fix, you must thoroughly test all Firebase features in your app to ensure they don't cause crashes or unexpected behavior.mehdiyari commentedon Oct 16, 2025
I don't see any safe solution for now (excluding options that could cause runtime crashes or using a new version that would cause build-time errors). It's better to use a version that is compatible with both of these libraries.
I'm using these two, and they are working fine together.
daniel-waiguru commentedon Oct 28, 2025
Are there any plans to fix this issue?
zenyagami commentedon Dec 26, 2025
Any update on this? removing the well-know classes will cause runtime crashes using firestore.
nuhkoca commentedon Jan 11, 2026
Up
orcuns commentedon Jan 28, 2026
I have the same issue!
protobufVersion = "4.26.1" is the only way it works
wantroba commentedon Feb 4, 2026
Same problem here. The strangest thing is that it started without me making any changes to the project.
What I did was add this snippet to the beginning of the app/build.grade file, right after the plugins section:
Uma1r commentedon Apr 1, 2026
Is there an update on this? Adding protobuf is breaking firestore for us and if exclusion for
protolite-well-known-typesis not done then the project won't compile due to duplicate class errors.AhmedGarhy commentedon Apr 14, 2026
I've tried the below configuration, and it worked!
To avoid conflicts with
protobuf-javaliteandprotolite-well-known-types, explicitly exclude them from both the Firebase BoM and firebase-perf dependencies.Additionally, the ProGuard rule ensures that fields in classes extending
GeneratedMessageLiteare retained, preventing runtime issues caused by code shrinking.dconeybe commentedon Oct 8, 2026
Update: Firebase Android BoM version 35.0.0 (released October 07, 2026) includes #8580 which upgrades the gRPC and protobuf dependencies to their latest versions. This may fix the problems reported in this issue. Please try upgrading and report your findings.
solamour commentedon Oct 10, 2026
I've been stuck with
protobuf-javalite = "4.26.1"because anything more recent gave me "duplicate class" error.Firebase BoM
35.0.0solved the issue, at least for me. Curious to know how it works for others.orcuns commentedon Oct 15, 2026
We've been stuck with protobuf-javalite = "4.26.1" for ages too. Firebase BoM 35.0.0 also solved the issue on our side.
Thanks..
dlarocque commentedon Oct 20, 2026
I will be closing this issue after confirmation that 35.0.0 solved the issue for multiple users.