Android X 向后兼容性 [英] Android X backwards compatibility
问题描述
我有使用支持库版本 27.1.2 的 Android 应用程序.我想使用使用 Android X (api 28) 编写的库.
I have Android App that uses support library versions 27.1.2. I want to consume a library written using Android X (api 28).
库版本的名称间距几乎没有问题.
There are few issues with name spacing of the library versions.
示例...
图书馆有一个对话框,我想与 api 一起使用
The library has a Dialog that I want to use with the api
Dialog.show(androidx.fragment.app.FragmentActivity activity);
但是我所有的活动都在使用
However all my activities are using
android.support.v4.app.FragmentActivity
编译器不喜欢这个.
目前无法将我的项目升级到最新版本,所以请不要升级答案,除非这是唯一的解决方案.
Currently it is not an option to upgrade my project to latest version, so please no upgrade answers, unless this is the only solution.
有没有办法解决这个不兼容的问题?
Is there a way to resolve this incompatibility issue?
提前致谢.
推荐答案
这是不可能的.要使用任何依赖于 AndroidX 的库,您的项目必须将整个项目迁移到 AndroidX.
This is not possible. To use any library that depends on AndroidX, your project must migrate your whole project to AndroidX.
请注意,反向是支持的 - 您可以在使用 AndroidX 的项目中使用通过支持库构建的库(这是 android.enableJetifier=true
标志的目的).
Note that the reverse is supported - you can use libraries built with Support Library in projects that use AndroidX (that's the purpose of the android.enableJetifier=true
flag).
这篇关于Android X 向后兼容性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!