'Duplicate class com.google.android.a.a found in modules?

I tried adding Installreferrer to my app after adding it to gradle, when rebuilding the app. I'm getting this error.

Duplicate class com.google.android.a.a found in modules jetified-installreferrer-2.2-runtime (com.android.installreferrer:installreferrer:2.2) and jetified-payu-gpay-1.3.2-runtime (com.payu.gpay:payu-gpay:1.3.2)

Duplicate class com.google.android.a.b found in modules jetified-installreferrer-2.2-runtime (com.android.installreferrer:installreferrer:2.2) and jetified-payu-gpay-1.3.2-runtime (com.payu.gpay:payu-gpay:1.3.2)

Duplicate class com.google.android.a.c found in modules jetified-installreferrer-2.2-runtime (com.android.installreferrer:installreferrer:2.2) and jetified-payu-gpay-1.3.2-runtime (com.payu.gpay:payu-gpay:1.3.2)



Solution 1:[1]

Downgrading the version number of library to 2.1 as mentioned in comment didn't help as I was getting the issue for FirebasePerformancePlugin too. So I believe other libraries too can have conflict.

Here is what I did.

  1. Confirmed a.a.a exists by analyzing apk.

Build > Analyze apk.

enter image description here

You can see there is a file a.a.a which is an empty interface which was clashing with the library.

  1. Open mapping.txt file

Auto generated build folder > output > mapping > prodRelease > mapping.txt

Search for a.a.a

enter image description here

  1. Open the file which maps a.a.a. My case it was DataBindingComponent in androidx.databinding package

enter image description here

It is an interface which seems identical as in the first image represented by a.a.a

  1. Exclude it on proguard

enter image description here

I don't know if it is a proper solution. Do rectify if there is any proper/ better solution.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 debugger