How to resolve two different classes with the same name in dependencies

Viewed 102

I will say right away that I have not found the answer to the question below anywhere.

In build.gradle(:app) I have:

...
implementation platform('com.google.firebase:firebase-bom:30.4.1')
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-storage'
implementation 'com.google.firebase:firebase-firestore'
...

After adding:

implementation platform('com.google.cloud:libraries-bom:26.1.1')
implementation 'com.google.cloud:google-cloud-kms'

During Rebuilding Project I got an error message specifically:

Duplicate class com.google.api.Advice found in modules jetified-proto-google-common-protos-2.9.2 (com.google.api.grpc:proto-google-common-protos:2.9.2) and jetified-protolite-well-known-types-18.0.0-runtime (com.google.firebase:protolite-well-known-types:18.0.0)

I found this class com.google.api.Advice and it turned out that they are two completely different classes with the same package:

Gradle: com.google.firebase:protolite-well-known-types:18.0.0@aar

package com.google.api;

import ...

public final class Advice extends GeneratedMessageLite<Advice, Advice.Builder> 
    implements AdviceOrBuilder {
    ...
}

Gradle: com.google.api.grpc:proto-google-common-protos:2.9.2

package com.google.api;
        
public final class Advice extends com.google.protobuf.GeneratedMessageV3
                implements AdviceOrBuilder {
    ...
}

Because of this, I can't just exclude any of these classes. And even more so after the exclusion of any of these classes, I have a partial loss of functionality of my application.

As a result, I have to leave these classes. But how to do that? Or maybe I've localized the problem incorrectly?

0 Answers
Related