khalti / khalti-sdk-android

SDK for Khalti Android App
23 stars 15 forks source link

Can't disable R8 in newer gradle version #33

Open theGBguy opened 1 year ago

theGBguy commented 1 year ago

We can't disable R8 in gradle version newer than 7.0. So, it is causing conflict with other dependencies because some of them also have obfuscated a.a(a.b / whatever) class which this library also has. The build logs is as ### follows:

Duplicate class a.a found in modules jetified-eSewaSdk-runtime (eSewaSdk.aar) and jetified-khalti-android-2.01.02-runtime (com.khalti:khalti-android:2.01.02)
Duplicate class b.a found in modules jetified-eSewaSdk-runtime (eSewaSdk.aar) and jetified-khalti-android-2.01.02-runtime (com.khalti:khalti-android:2.01.02)
Duplicate class b.b found in modules jetified-eSewaSdk-runtime (eSewaSdk.aar) and jetified-khalti-android-2.01.02-runtime (com.khalti:khalti-android:2.01.02)
Duplicate class b.c found in modules jetified-eSewaSdk-runtime (eSewaSdk.aar) and jetified-khalti-android-2.01.02-runtime (com.khalti:khalti-android:2.01.02)
Duplicate class c.a found in modules jetified-eSewaSdk-runtime (eSewaSdk.aar) and jetified-khalti-android-2.01.02-runtime (com.khalti:khalti-android:2.01.02)

Solution: as discussed here, please use flattenpackagehierarchy in your ProGuard rules to move obfuscated classes in some unique package to prevent aforementioned conflicts with other libraries.