Search code examples
androidandroid-studioandroid-jetpackandroidxandroid-jetifier

AndroidX migration using Jetifier tool converts support libraries to RC versions


In the process of migrating to Android X, tt seems that Jetifier tool converts some of the 3rd party libraries to RC versions (gradle-4.6).

 |    +--- com.facebook.android:facebook-common:4.34.0
|    |    |    +--- com.facebook.android:facebook-core:4.34.0 (*)
|    |    |    +--- com.google.zxing:core:3.3.0
|    |    |    +--- androidx.legacy:legacy-support-v4:1.0.0-rc01
|    |    |    |    +--- androidx.core:core:1.0.0-rc01 -> 1.0.1 (*)
|    |    |    |    +--- androidx.media:media:1.0.0-rc01
|    |    |    |    |    +--- androidx.annotation:annotation:1.0.0-rc01 -> 1.0.0
|    |    |    |    |    +--- androidx.core:core:1.0.0-rc01 -> 1.0.1 (*)
|    |    |    |    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0-rc01 -> 1.0.0 (*)
|    |    |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0-rc01 -> 1.0.0 (*)
|    |    |    |    +--- androidx.legacy:legacy-support-core-ui:1.0.0-rc01 -> 1.0.0 (*)
|    |    |    |    \--- androidx.fragment:fragment:1.0.0-rc01 -> 1.0.0 (*)
|    |    |    +--- androidx.appcompat:appcompat:1.0.0-rc01 -> 1.0.2 (*)
|    |    |    +--- androidx.cardview:cardview:1.0.0-rc01 -> 1.0.0 (*)
|    |    |    \--- androidx.browser:browser:1.0.0-rc01
|    |    |         +--- androidx.core:core:1.0.0-rc01 -> 1.0.1 (*)
|    |    |         +--- androidx.annotation:annotation:1.0.0-rc01 -> 1.0.0
|    |    |         +--- androidx.interpolator:interpolator:1.0.0-rc01 -> 1.0.0 (*)
|    |    |         +--- androidx.collection:collection:1.0.0-rc01 -> 1.0.0 (*)
|    |    |         \--- androidx.legacy:legacy-support-core-ui:1.0.0-rc01 -> 1.0.0 (*)

Is there a solution I can force to take only stable (fixed) versions?


Solution

  • Well, after digging in jetifier source code, it seems that the jetifier version comes with gradle-4.6 is alpha10:

    /gradle/m2repository/com/android/tools/build/jetifier/jetifier-processor/1.0.0-alpha10⁩/jetifier-processor-1.0.0-alpha10.jar /gradle/m2repository/com/android/tools/build/jetifier/jetifier-core/1.0.0-alpha10⁩/jetifier-core-1.0.0-alpha10.jar

    The local mapping file in this package jetifier converts some of the support libraries to RC versions.

    Adding an updated jetifier dependencies solves this issue (top build.gradle):

     classpath 'com.android.tools.build.jetifier:jetifier-core:1.0.0-beta02'
     classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
    

    And here are the results for facebook dependencies tree:

    +--- com.facebook.android:facebook-common:4.34.0
    |    |    |    +--- com.facebook.android:facebook-core:4.34.0 (*)
    |    |    |    +--- com.google.zxing:core:3.3.0
    |    |    |    +--- androidx.legacy:legacy-support-v4:1.0.0
    |    |    |    |    +--- androidx.core:core:1.0.0 -> 1.0.1 (*)
    |    |    |    |    +--- androidx.media:media:1.0.0
    |    |    |    |    |    +--- androidx.annotation:annotation:1.0.0
    |    |    |    |    |    +--- androidx.core:core:1.0.0 -> 1.0.1 (*)
    |    |    |    |    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0 (*)
    |    |    |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
    |    |    |    |    +--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
    |    |    |    |    \--- androidx.fragment:fragment:1.0.0 (*)
    |    |    |    +--- androidx.appcompat:appcompat:1.0.0 -> 1.0.2 (*)
    |    |    |    +--- androidx.cardview:cardview:1.0.0 (*)
    |    |    |    \--- androidx.browser:browser:1.0.0
    |    |    |         +--- androidx.core:core:1.0.0 -> 1.0.1 (*)
    |    |    |         +--- androidx.annotation:annotation:1.0.0
    |    |    |         +--- androidx.interpolator:interpolator:1.0.0 (*)
    |    |    |         +--- androidx.collection:collection:1.0.0 (*)
    |    |    |         \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)