0

I am trying to upgrade the version of Google Play in order to target API Version 34. And getting the below error

Duplicate class com.google.android.play.core.listener.StateUpdatedListener found in modules core-1.6.1.aar -> jetified-core-1.6.1-runtime (com.google.android.play:core:1.6.1) and core-common-2.0.2.aar -> jetified-core-common-2.0.2-runtime (com.google.android.play:core-common:2.0.2)

My gradle dependecies is as follows

dependencies {

    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'androidx.activity:activity-ktx:1.9.0'
    implementation 'androidx.fragment:fragment-ktx:1.8.1'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation "androidx.preference:preference-ktx:1.2.1"

    def room_version = '2.6.1'
    implementation "androidx.room:room-runtime:$room_version"
    ksp "androidx.room:room-compiler:$room_version"
    implementation "androidx.room:room-ktx:$room_version"


}

I am not able to resolve where the old version is still being pulled in during build.

Running the below command doesn't list anything apart from

./gradlew dependencies

No configurations

A web-based, searchable dependency report is available by adding the --scan option.

BUILD SUCCESSFUL in 11s
1 actionable task: 1 executed

1 Answer 1

0

Turns out I had to run the below command to see the dependency tree, and find out which library I was using was pulling in the outdated play library.

./gradlew -q app:dependencies

And it gave me the transitive dependencies of in a hierarchical structure. A search for com.google.android.play:core reveled where the issue was, as in the root of the conflicting dependency.

+--- com.google.android.play:review:2.0.1
|    +--- com.google.android.gms:play-services-basement:18.1.0 -> 18.3.0 (*)
|    +--- com.google.android.gms:play-services-tasks:18.0.2 -> 18.1.0 (*)
|    \--- com.google.android.play:core-common:2.0.2 -> 2.0.3
+--- com.google.android.play:app-update:2.1.0
|    +--- com.google.android.gms:play-services-basement:18.1.0 -> 18.3.0 (*)
|    +--- com.google.android.gms:play-services-tasks:18.0.2 -> 18.1.0 (*)
|    \--- com.google.android.play:core-common:2.0.3
\--- com.github.dnKaratzas:android-inapp-update:1.0.2
     +--- com.google.android.play:core:1.6.1
     +--- androidx.annotation:annotation:1.1.0 -> 1.6.0 (*)
     +--- androidx.lifecycle:lifecycle-runtime:2.2.0-alpha02 -> 2.6.2 (*)
     \--- com.google.android.material:material:1.0.0 -> 1.12.0 (*)

Sadly since com.github.dnKaratzas:android-inapp-update hasn't been updated in a long time, I would have to drop the usage of this feature to make the app compliant with the latest Google Play Policies when targeting API 34.

Source: https://docs.gradle.org/current/userguide/part3_gradle_dep_man.html

1
  • 1
    In the new android studio we have a UI button under gradle/tasks/help on the right side vertical bar, which will run this command for us.
    – Justin
    Commented Jul 6 at 18:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.