I am trying to implement flutter plugin in_app_review in one of my flutter project but i am getting duplicate dependency error.
I think some of the plugin from my project is somewhere adding play core dependency which is causing this issue.
Please help me figure out the solution.
I am getting this error log.
Execution failed for task ‘:app:checkUatDebugDuplicateClasses’.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class com.google.android.play.core.common.IntentSenderForResultStarter found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2)
Duplicate class com.google.android.play.core.common.LocalTestingException found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2)
Duplicate class com.google.android.play.core.common.PlayCoreDialogWrapperActivity found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2)
Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2)
Duplicate class com.google.android.play.core.review.ReviewInfo found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1)
Duplicate class com.google.android.play.core.review.ReviewManager found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1)
Duplicate class com.google.android.play.core.review.ReviewManagerFactory found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1)
Duplicate class com.google.android.play.core.review.testing.FakeReviewManager found in modules jetified-core-1.8.0-runtime (com.google.android.play:core:1.8.0) and jetified-review-2.0.1-runtime (com.google.android.play:review:2.0.1)
3
Answers
I found the solution to the problem. It was happening because I was using;
implementation 'com.google.android.play:core:1.10.3'
implementation'com.google.android.play:core-ktx:1.8.1'
These two dependencies are in my android folder for in-app update and I thought
com.google.android.play:core:1.10.3
is responsible for the duplicate dependency issue so when I commented that out it was still giving duplicate dependency issue ascom.google.android.play:core-ktx:1.8.1
is also the same so I check on developer guide page where this dependency is now separated according to feature from core dependency then I removed this two dependencies and added implementation'com.google.android.play:app-update-ktx:2.0.1'
this one as I was doing the in-app update as well. which helped me fix my problem.my app has both in_app_review and rate_my_app and i have the same issue.
i solved it by locking in_app_review to 2.0.4:
2.0.4 not ^2.0.4.
looks like 2.0.5 introduced this bug.
For me it removing the rate_my_app package fixed it