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

Dor*_*onK 0 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 (*)
Run Code Online (Sandbox Code Playgroud)

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

Dor*_*onK 5

好了,在探究了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'
Run Code Online (Sandbox Code Playgroud)

这是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 (*)
Run Code Online (Sandbox Code Playgroud)