使用Jetifier工具进行AndroidX迁移会将支持库转换为RC版本

时间:2018-11-21 15:34:29

标签: android android-studio android-jetpack androidx android-jetifier

在迁移到Android X的过程中,tt似乎Jetifier工具将一些第三方库转换为RC版本(第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 (*)

是否可以强制采用仅稳定(固定)版本的解决方案?

1 个答案:

答案 0 :(得分:4)

好吧,在探究了jetifier源代码之后,似乎gradle-4.6附带的jetifier版本是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

此包jetifier中的本地映射文件将某些支持库转换为RC版本。

添加更新的jetifier依赖项可以解决此问题(顶部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'

这是facebook依赖树的结果:

+--- 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 (*)