androidgradleaws-amplify-sdk-android

Gradle - Android - In App Review causes compile error - Amplify old dependency


I am trying to integrate In App Review and I get this compile error:

Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-core-common-2.0.0-runtime (com.google.android.play:core-common:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)
Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.9.1-runtime (com.google.android.play:core:1.9.1) and jetified-review-2.0.0-runtime (com.google.android.play:review:2.0.0)

Go to the documentation to learn how to Fix dependency resolution errors.

Edit: I ran the command: ./gradlew app:dependencies >> deps.txt and found out that the conflict is caused by Amplify core. It has a dependency on androidx.navigation:navigation-dynamic-features-fragment:2.3.4 for some reason and that's has com.google.android.play:core:1.9.1 inside.

How can I prevent Amplify causing this? How to solve this confilct?

Here is the dependency tree


Solution

  • I was able to solve this by changing the gradle file:

     // gradle imports from Amplify docs below.
    implementation('com.amplifyframework:aws-storage-s3:1.35.4') {
        exclude group: 'com.google.android.play', module: 'core'
    }
    
    implementation('com.amplifyframework:aws-auth-cognito:1.35.4') {
        exclude group: 'com.google.android.play', module: 'core'
    }
    // Amplify core dependency
    implementation('com.amplifyframework:core:1.35.4') {
        exclude group: 'com.google.android.play', module: 'core'
    }