Android X向后兼容 [英] Android X backwards compatibility

查看:348
本文介绍了Android X向后兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有使用支持库版本27.1.2的Android App.我想使用一个使用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

并且编译器不喜欢这样.

and the compiler does not like this.

当前不能将我的项目升级到最新版本,因此,除非这是唯一的解决方案,否则请不要升级答案.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆