Disabling Jetifier - sergei-lapin/pimp-my-gradle-recipes GitHub Wiki
So, you're up to disabling Jetifier in your project?
Well, I have a guide for you, that, hopefully, will er... guide you through this tough process.
First thing you'll need on that tricky path is CanIDropJetifier Gradle plugin applied to your root project's build.gradle file as following:
plugins {
id "com.github.plnice.canidropjetifier" version "0.5"
}
After that you can run it's specific task with following command
./gradlew -Pandroid.enableJetifier=false canIDropJetifier
Hopefully, at that point, you'll get a permission from that plugin to remove Jetifier (android.enableJetifier=true) from your gradle.properties and you're done with it. If it's not the case, then follow along
- Download jetifier-standalone tool
- Download dependencies from CanIDropJetifier report that require jetifying
- Jetify the
.aarfiles according to jetifier-standalone documentation, preserving the original artifact name - Modify library
.pomfile according to artifact mappings in order for it to request correct dependencies during dependency resolution stage - Put modified library artifact along with modified
.pomfile to the same path on your Nexus/Artifactory/Maven Local as it was with it's original source (e.g. forme.relex:circleindicator:1.3.2dependency path would beme/relex/circleindicator/1.3.2) - Specify where to resolve the jetified dependencies in your gradle scripts (via placing your repository above other alternatives/via specifying exclusive content for your repository)
- And you're almost done, now you can remove this
android.enableJetifier=trueline from yourgradle.propertiesfile - The only thing that is left is to perform regression testing of your app, because there is such thing as fatJar dependencies
Dealing with fatJar dependencies
fatJar libraries are called so because they are not declaring any dependencies in their .pom files and rather packing all of them during their assembling process. So, such libraries can't be spotted by CanIDropJetifier plugin and though they require manual jetification they won't appear on plugins task output. The only way to spot them is during regression testing of your app after performing operations mentioned above, you might get runtime crashes saying that some class, android.support.v7.widget.Toolbar, for example, is missing on the runtime classpath, and by the stacktrace you could identify the library that is using legacy classes, perform steps 3, 5, 6 with it and now you're done disabling jetifier for your project. Congratulations!