Can I use library that used android support with Androidx projects.
You can enable Jetifier
on your project, which will basically exchange the Android Support Library
dependencies in your project dependencies with AndroidX
-ones. (e.g. Your Lottie dependencies will be changed from Support to AnroidX)
From the Android Studio Documentation (https://developer.android.com/studio/preview/features/):
The Android Gradle plugin provides the following global flags that you
can set in your gradle.properties file:
- android.useAndroidX: When set to true, this flag indicates that you want to start using AndroidX from now on. If the flag is absent,
Android Studio behaves as if the flag were set to false.- android.enableJetifier: When set to true, this flag indicates that you want to have tool support (from the Android Gradle plugin) to
automatically convert existing third-party libraries as if they were
written for AndroidX. If the flag is absent, Android Studio behaves as
if the flag were set to false.
Precondition for Jetifier:
- you have to use at least
Android Studio 3.2
To enable jetifier, add those two lines to your gradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true
Finally, please check the release notes of AndroidX, because jetifier
has still some problems with some libraries (e.g. Dagger Android): https://developer.android.com/topic/libraries/support-library/androidx-rn
Can I use library that uses Androidx with support library project?
Using support libraries is not a recommended practice anymore, and you should migrate to androidx as soon as possible. Migration is easy, and Android Studio takes care of the heavy lifting for you.
Can I use a Library that used AndroidX with an android support project?
No, I don't think you can.
But you can the other way! So there should be no reason not to migrate your own project to AndroidX.
Android Studio 3.6.1 | Error: This project uses AndroidX dependencies
The Android Gradle plugin provides the following global flags that you
can set in your gradle.properties file:android.useAndroidX: When set to true, this flag indicates that you
want to start using AndroidX from now on. If the flag is absent,
Android Studio behaves as if the flag were set to false.android.enableJetifier: When set to true, this flag indicates that you
want to have tool support (from the Android Gradle plugin) to
automatically convert existing third-party libraries as if they were
written for AndroidX. If the flag is absent, Android Studio behaves as
if the flag were set to false.
To enable jetifier, add those two lines to your gradle.properties file:
android.useAndroidX=true
android.enableJetifier=true
Is there a way to mix AndroidX and a subproject that uses the support library?
All modules used in your app need to move to AndroidX together. You'd need to move your module you want to keep on Support Library into a new project and only use it as a maven dependency or AAR in your AndroidX project.
Related Topics
Call Activity Method from Adapter
Android: Bitmaps Loaded from Gallery Are Rotated in Imageview
How to Import Existing Android Project into Eclipse
How to Decompile an Android .Apk File
How to Play Ringtone/Alarm Sound in Android
How to Change the Color of Alertdialog Title and the Color of the Line Under It
How to Pass the Values from One Activity to Previous Activity
Counting Chars in Edittext Changed Listener
How to Keep the Screen on in My App
How to Hide Soft Keyboard When Activity Starts
How to Switch Activity Without Animation in Android
Draw Multi-Line Text to Canvas
Android: How to Use Onbackpressed() with Toast
How to Get Camera Result as a Uri in Data Folder
Add and Remove Views in Android Dynamically