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.
Example ...
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?
Thanks in advance.
This is not possible. To use any library that depends on AndroidX, your project must migrate your whole project to AndroidX.
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).AndroidX[About]
support
-> ProducerandroidX
- not compatible.You should migrate your consumer to use AndroidX.
Android Studio menu -> Refactor -> Migrate to AndroidX...
androidX
-> Producersupport
- compatible.Consumer's
gradle.properties
in addition to useandroidX
should enableJetifier
[About] which convertsupport
toandroidX