firebase / firebase/firebase-android-sdk

Duplicate class exception with protobuf

Open
#4,927 8 comments 1 reaction 1 assignee Claimed by @wu-hui View on GitHub
api: firestore needs-attention
Dominant language
Java
Stars
2.6k
Forks
710
Avg merge
2d 9h
Merged PRs (30d)
31

Description

### [REQUIRED] Step 2: Describe your environment

Android Studio version: Electric Eel | 2022.1.1 Patch 1
Firebase Component: Firestore
Component version: 24.2.1 (BoM: 30.3.0)

### [REQUIRED] Step 3: Describe the problem

I am using firebase with the following dependencies

```
implementation (platform('com.google.firebase:firebase-bom:30.3.0'))
implementation ('com.google.firebase:firebase-analytics-ktx')
implementation ('com.google.firebase:firebase-messaging-ktx')
implementation ('com.google.firebase:firebase-firestore-ktx')
implementation ('com.google.firebase:firebase-perf-ktx')
```

I have created a SDK which uses protobuf java. Since the firebase uses protobuf java lite. It results in duplicate class exception.

I cannot exclude protobuf from my SDK dependency because that would cause a **java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/protobuf/GeneratedMessageV3;** exception.

If I exclude protobuf from firebase. It still shows duplicate class exception because it has a nested dependency.
`com.google.firebase:protolite-well-known-types:18.0.0@aar`

They have created a package with **com.google.protobuf** inside this module.

I cannot exclude this dependency, because it would result in same **NoClassDefFoundError**.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.