What is Jetifier? For example, to create a new project using the androidx-packaged dependencies, this new project needs to add the following line to the gradle.properties file:
android.enableJetifier=true
So what does it mean - "enable jetifier"?
Assuming that you are familiar with AndroidX
. If not, please see @this post.
Jetifier
will convertsupport libraries
of all your dependencies toAndroidX
automatically, if you don't set it totrue
then your project will have both, the support (got deprecated after 28.0.0 version) and AndroidX package, which is redundant.
If you have PhotoView.java
in your dependency. That uses support library AppCompatImageView
.
import android.support.v7.widget.AppCompatImageView;
This class is moved now to androidx
package, so how will PhotoView
get androidx AppCompatImageView
? And app still runs in device.
Who made this run ?
Jetifier, which converts all support package of dependency at build time.
Jetifier will convert android.support.v7.widget.AppCompatImageView
to androidx.appcompat.widget.AppCompatImageView
while building the project.
Enabling Jetifier is important when you migrate from Support Libraries to AndroidX.
See this post to understand more about AndroidX.
Your code may show compile time errors after enabling Jetifier while using dependency classes.
which you can remove by deleting .idea
, .gradle
and re-sync project.