Open In App

Android – Jetifier

By using the standalone Jetifier tool, libraries that rely on support libraries are converted to use comparable AndroidX packages. Utilizing the tool, you can migrate a single library without using the Android Gradle plugin included with Android Studio.

So What’s the Usage?

Pass the path to the current library and the path to the output file that the tool should create in order to process a library. Jetifier supports nested archives in JAR, AAR, and ZIP files. Jetpack is a collection of tools, guides, and libraries that make it easier for you to create high-quality apps. By following best practices, reducing boilerplate code, and streamlining challenging processes, Jetpack makes development simpler. All with the intention of allowing you to concentrate on the code that matters to you the most. The package name for all of the libraries included with Jetpack is AndroidX. Consider AndroidX to be the open-source initiative used to create, test, release, and modify the Jetpack libraries. Because the Android Gradle Plugin must convert all the support-library-dependent artifacts to AndroidX, having Jetifier enabled on your project (android.enableJetifier = true on your gradle.properties) affects the build performance. Therefore, if you want to slow down the build process for your Android project, deactivating jetifier is a smart option. But it’s not always an easy process to achieve that. To help you properly migrate your app to AndroidX and then securely stop Jetifier, we have developed a list of 6 actions to take.



What is Android X?

For Android support libraries such as support, data-binding, design, etc., there is a new package format called AndroidX. It is just so astonishing that you won’t even need to get your old libraries converted to newer ones, it takes care of that process too! For instance, developers will now import libraries in our applications using androidx.data binding rather than android.databinding. Google may now include SemVer, or Semantic Versioning, in their library package as a result. This frees developers from having to utilize the same support library version across all support libraries. Each support, or better yet, each library for AndroidX, will keep track of its own versioning. The fact that we don’t have to worry about keeping the same version for every supported library in our project is another benefit for developers. More info about Android X is here. To add it to your Android App, you should simply declare it, this way:

android.enableJetifier=true
android.useAndroidX=true

Some sophisticated uses:



Some sophisticated use cases are supported by the Jetifier tool:

Conclusion

Using the Android Jetifier is crucial, if you don’t set it to true, your project will contain both the support (which became deprecated after the 28.0.0 release) and AndroidX packages, which is unnecessary. 

Article Tags :