skip to Main Content

I’m looking to implement in-app updates and am following the guidance provided by Google

https://developer.android.com/guide/playcore/in-app-updates/kotlin-java#kts

As such i’m trying to add the following dependencies

implementation("com.google.android.play:app-update:2.0.0")
implementation("com.google.android.play:app-update-ktx:2.0.0")

However when trying to build the project I am confronted with a Duplicate class found error. One example provided below, although there are many of these

com.google.android.play.core.appupdate.AppUpdateInfo found in modules jetified-app-update-2.0.0-runtime (com.google.android.play:app-update:2.0.0) and jetified-core-1.10.2-runtime (com.google.android.play:core:1.10.2)

I tried to work. around this by adding some exclude clauses in configurations

configurations {
    all {
        exclude group: "com.google.android.play", module: "app-update"
        exclude group: "com.google.android.play", module: "core"
    }
}

The example above is the one that finally allowed the program to build, however when I go to utilise the library it is clear many of its elements have not been imported correctly. When I try to instantiate the AppUpdateManager, it is missing and AppUpdateResult seems to be the only one available to use.

enter image description here

Would really appreciate some guidance on what I may be doing wring here and any fixes or workarounds

3

Answers


  1. There’s no point in adding a dependency twice, only to exclude it from the build.
    Only add implementation("com.google.android.play:app-update-ktx:2.0.0").

    Login or Signup to reply.
  2. use this

    implementation 'com.google.android.play:core:1.9.0'
    

    and remove both

    implementation("com.google.android.play:app-update:2.0.0")
    implementation("com.google.android.play:app-update-ktx:2.0.0")
    
    Login or Signup to reply.
  3. I had a similar problem. In short, I was using com.google.android.play:core-ktx and wanted to migrate to "multiple per-feature libraries" (https://developer.android.com/guide/playcore#playcore-migration). But I kept getting "duplicate com.google.android.play:core" error message, even though I already removed it.

    It turned out that one of the libraries I was using (androidx.navigation:navigation-dynamic-features-fragment:2.5.0-alpha03, to be specific) was including com.google.android.play:core:1.10.2 behind the scene. When I updated to androidx.navigation:navigation-dynamic-features-fragment:2.6.0-alpha08, the problem went away, and I was able to migrate to Google Play Core’s per-feature libraries.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search