Home > database >  Conflict on class names after code obfuscation on two different SDK
Conflict on class names after code obfuscation on two different SDK

Time:05-12

When minified is enabled, there is a conflict between the obfuscated names of two different SDKs.

Duplicate class a.a, etc

I am trying to figure out if there is any way to solve this?

> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class a.a found in modules jetified-amazonpay-hardened-silentpay-sdk-1.3.0-runtime (in.juspay:amazonpay-hardened-silentpay-sdk:1.3.0) and jetified-diagnostics-1.0.20-runtime (com.android:diagnostics:1.0.20)
     Duplicate class b.a found in modules jetified-amazonpay-hardened-silentpay-sdk-1.3.0-runtime (in.juspay:amazonpay-hardened-silentpay-sdk:1.3.0) and jetified-diagnostics-1.0.20-runtime (com.android:diagnostics:1.0.20)
     Duplicate class b.b found in modules jetified-amazonpay-hardened-silentpay-sdk-1.3.0-runtime (in.juspay:amazonpay-hardened-silentpay-sdk:1.3.0) and jetified-diagnostics-1.0.20-runtime (com.android:diagnostics:1.0.20)
     Duplicate class b.c found in modules jetified-amazonpay-hardened-silentpay-sdk-1.3.0-runtime (in.juspay:amazonpay-hardened-silentpay-sdk:1.3.0) and jetified-diagnostics-1.0.20-runtime (com.android:diagnostics:1.0.20)
     Duplicate class c.a found in modules jetified-amazonpay-hardened-silentpay-sdk-1.3.0-runtime (in.juspay:amazonpay-hardened-silentpay-sdk:1.3.0) and jetified-diagnostics-1.0.20-runtime (com.android:diagnostics:1.0.20)

CodePudding user response:

What causes it is implentation of a dependency into build.gradle module file more than once. But i've witnessed this situation and discovered no duplicate library was implemented until i added this to gradle.properties file

android.useAndroidX=true
android.enableJetifier=true

According to @Farmanbar

Jetifier tool migrates support-library-dependent libraries to rely on the equivalent AndroidX packages instead. The tool lets you migrate an individual library directly, instead of using the Android gradle plugin bundled with Android Studio.

And for more information take a look at Exclude transitive dependencies

As an app grows in scope, it can contain a number of dependencies including direct dependencies and transitive dependencies (libraries which your app's imported libraries depend on). To exclude transitive dependencies that you no longer need, you can use the exclude keyword

If you have problems excluding classes, check this thread: How do I exclude all instances of a transitive dependency when using Gradle?

CodePudding user response:

Guess only one of these is required:

// implementation 'in.juspay:amazonpay-silentpay-sdk:1.2.0'
implementation 'in.juspay:amazonpay-hardened-silentpay-sdk:1.3.0'

android.enableJetifier=false is rather the default value.

  • Related