jetifier
Migrate support libraries to AndroidX
TLDR
Migrate project dependencies to the AndroidX format
Migrate project dependencies from the AndroidX format
SYNOPSIS
The standalone Jetifier tool is invoked via the Java Virtual Machine:
java -jar jetifier-standalone.jar [OPTIONS] <INPUT_PATH> <OUTPUT_PATH>
PARAMETERS
--input <path>
Specifies the input file or directory to be jetified. This can be an Android Archive (AAR), Java Archive (JAR), or a directory containing multiple such artifacts.
--output <path>
Defines the output location where the jetified artifacts will be saved. This must be a different path from the input to prevent overwriting.
--config <path>
Provides a path to an optional custom configuration file (e.g., `jetifier-config.txt`). This allows users to define or override specific mapping rules for transformations.
--strip-signatures
Removes existing JAR signatures from signed artifacts during the jetification process. This is often necessary because bytecode modification invalidates digital signatures.
--force-copy-unchanged
If an input artifact does not require any jetification changes, this option ensures it is still copied to the specified output directory.
--log-level <level>
Sets the verbosity level for logging output. Common levels include `INFO`, `DEBUG`, `VERBOSE`, and `ERROR`.
--help
Displays comprehensive help information about the command's usage and options, then exits.
--version
Prints the current version of the Jetifier tool and then exits.
DESCRIPTION
The Jetifier tool is a utility provided by Google primarily for migrating Android libraries that use the deprecated Android Support Library to the new AndroidX namespace.
When integrating older libraries into a modern Android project that uses AndroidX, compatibility issues can arise due to package and class name changes. Jetifier resolves these by transforming the bytecode of compiled libraries (JARs and AARs) to remap the old Support Library class and method references to their corresponding AndroidX equivalents.
This transformation is crucial for projects that have already migrated to AndroidX, allowing them to use dependencies that haven't yet been updated by their maintainers. It operates by finding and replacing package names, classes, and methods, ensuring seamless integration. While it can be run standalone, Jetifier functionality is also deeply integrated into the Android Gradle Plugin, often running automatically during the build process when `android.enableJetifier=true` is set in `gradle.properties`.
CAVEATS
The Jetifier tool requires a Java Runtime Environment (JRE) to be installed on the system, as it is distributed as a JAR file.
It is primarily designed for Android development workflows and is not a general-purpose Linux command.
While powerful, it operates by bytecode transformation, which can sometimes lead to subtle issues if libraries employ complex obfuscation or highly custom class loading mechanisms. Always back up original files before processing.
Its standalone use has decreased as its functionality is largely integrated into the Android Gradle Plugin, making direct command-line invocation less common for typical Android development.
DISTRIBUTION AND EXECUTION
Jetifier is distributed as a Java Archive (JAR) file, typically named `jetifier-standalone.jar`. It must be executed using a Java Runtime Environment (JRE) via the command `java -jar jetifier-standalone.jar`. Users need to download the JAR file separately, as it's not a native executable included with standard Linux distributions.
INTEGRATION WITH ANDROID GRADLE PLUGIN
For most Android developers, Jetifier's functionality is seamlessly integrated into the Android Gradle Plugin. When `android.enableJetifier=true` is set in a project's `gradle.properties` file, Gradle automatically runs Jetifier on third-party dependencies during the build process, translating them to use AndroidX without requiring manual invocation of the command.
HISTORY
The Jetifier tool was developed by Google as a critical component of the transition from the legacy Android Support Library to AndroidX. Introduced around the time of Android P (API 28), it became essential for projects migrating to AndroidX while still relying on third-party libraries built against the older Support Library. Its purpose was to automate the update of binary artifacts, ensuring backward compatibility and smoother migration for the Android ecosystem. While available as a standalone command-line tool, its most widespread use occurs automatically when enabled within the Android Gradle Plugin (e.g., by setting `android.enableJetifier=true` in `gradle.properties`), making it a background utility for most developers.
SEE ALSO
java(1)