Home > Software engineering >  Duplicate class a.a found in modules jetified android
Duplicate class a.a found in modules jetified android

Time:07-22

I am using two libraries in my app 1 aar and another gradle dependency. I am getting this error on building release build

Duplicate class a.a found in modules jetified-android-sdk-1.7.26-runtime (com.cashfree.pg:android-sdk:1.7.26) and jetified-adsdk-AN-1.15.16-runtime (adsdk-AN-1.15.16.aar)

This is my build gradle app level

implementation 'com.cashfree.pg:android-sdk:1.7.26'
implementation files('libs/adsdk-AN-1.15.16.aar')

//Dependencies used by all payment modes
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

Not able to understand this a.a class

CodePudding user response:

It seems that you've got a couple of classes with the same name when obfuscation is done.

a.a is an obfuscated name, you can find how it works and how to extract the mapping file for the obfuscated classes here. You can determine the package name from the mapping file (it will be like a.a -> some.package.name) and exclude it if the next step won't help you.

Check properties in your gradle.properties file, it should be like that.

android.useAndroidX=true
android.enableJetifier=true

If it is - then you'll have to explicitly exclude these classes. You can take a look at this answer.

CodePudding user response:

The issue was due to proguard rules of the SDK Add below rules to SDK proguard and it worked then

-repackageclasses 'com.example'
-allowaccessmodification
-useuniqueclassmembernames
-keeppackagenames doNotKeepAThing
  • Related