Migrating from deprecated jcenter - issue with Google Places library
Asked Answered
C

1

6

I am trying to remove jcenter() from my project because it is deprecated. But I am using com.google.android.libraries.places:places:2.4.0 dependency that is currently the latest version, that is outlined in official docs. And interesting thing, that when I try to build project it fails, because it can't find dependency com.android.volley:volley:1.1.1. I do not use this dependency in my project directly, but I found, that it is transitive dependency inside places library.

When I execute gradlew app:dependencies I can see such situation:

+--- com.google.android.libraries.places:places:2.4.0
|    +--- androidx.appcompat:appcompat:1.0.0 -> 1.3.1 (*)
|    +--- androidx.cardview:cardview:1.0.0 (*)
|    +--- androidx.fragment:fragment:1.1.0 -> 1.3.6 (*)
|    +--- androidx.lifecycle:lifecycle-extensions:2.1.0 -> 2.2.0 (*)
|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
|    +--- com.android.volley:volley:1.1.1 FAILED
|    +--- com.google.android.datatransport:transport-api:2.2.0 -> 3.0.0 (*)
|    +--- com.google.android.datatransport:transport-backend-cct:2.3.0 -> 3.0.0 (*)
|    +--- com.google.android.datatransport:transport-runtime:2.2.3 -> 3.0.0 (*)
|    +--- com.google.android.gms:play-services-base:17.2.1 -> 17.5.0 (*)
|    +--- com.google.android.gms:play-services-basement:17.0.0 -> 17.5.0 (*)
|    +--- com.google.android.gms:play-services-location:17.0.0 -> 18.0.0 (*)
|    +--- com.google.android.gms:play-services-maps:17.0.0
|    |    +--- androidx.fragment:fragment:1.0.0 -> 1.3.6 (*)
|    |    +--- com.google.android.gms:play-services-base:17.0.0 -> 17.5.0 (*)
|    |    \--- com.google.android.gms:play-services-basement:17.0.0 -> 17.5.0 (*)
|    +--- com.google.android.gms:play-services-tasks:17.0.0 -> 17.2.0 (*)
|    +--- com.google.auto.value:auto-value-annotations:1.6.2
|    \--- com.google.code.gson:gson:2.8.5 -> 2.8.7

So, com.google.android.libraries.places:places:2.4.0 uses outdated library com.android.volley:volley:1.1.1. Interesting thing, that com.android.volley is hosted on mavenCentral only starting from 1.2.0 version. And 1.1.1 version is available ONLY in Bintray: https://mvnrepository.com/artifact/com.android.volley/volley/1.1.1

My top-level config:

buildscript {
    ext.kotlin_version = '1.5.21'

    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:7.0.0'
        classpath 'com.google.gms:google-services:4.3.10'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

So, how can I migrate from jcenter when even Google didn't? Or am I missing something?

Consonance answered 12/8, 2021 at 13:7 Comment(0)
E
9

For now you can manually include the Volley dependency separately and exclude the 1.1.1 version from the Places dependency.

implementation('com.google.android.libraries.places:places:2.4.0') {
    exclude group: 'com.android.volley'
}
implementation 'com.android.volley:volley:1.2.0'

As you pointed out Volley is now on Maven Central so you'd also need to include the mavenCentral() repository.

Eyespot answered 1/9, 2021 at 18:5 Comment(1)
I think there is no need to exclude v1.1.1 since it will be overwritten by v1.2.0 when you include it manually.Sin

© 2022 - 2025 — McMap. All rights reserved.