androidandroidxandroid-jetifier

Jetifier is not resolving Play Services dependancies correctly


I'm trying to convert a project to AndroidX but have encountered a strange issue with one of the play services libraries. It seems that Jetifier is replacing only the version and not the package name:

+--- com.google.android.gms:play-services-location:16.0.0
|    +--- com.google.android.gms:play-services-base:16.0.1
|    |    +--- com.google.android.gms:play-services-basement:16.0.1
|    |    |    \--- com.android.support:support-v4:26.1.0 -> 1.0.0 FAILED

It should be replacing com.android.support:support-v4 with androidx.legacy:legacy-support-v4.

Is there a workaround for when Jetifier fails to convert dependancies in this way?


Solution

  • It turns out that simply excluding the support library does the job:

    implementation ('com.google.android.gms:play-services-location:16.0.0') {
        exclude group: 'com.android.support'
    }
    

    I had tried this initially, but it was failing on another module with the same error so it looked like it wasn't working.