'Failed to transform" error after migrating to AndroidX

I was able to work around a similar problem by excluding a certain library from being jetified, which can be done by adding to gradle.properties:

android.jetifier.blacklist = ...

Note that this option was added in Android Gradle plugin 3.3.0-rc01 as a temporary workaround. See https://issuetracker.google.com/issues/119135578#comment5 for more details.


For those experiencing the same issue with Android Studio 3.2 Canary 15 (or later) after using "Refactor to AndroidX...":

I had to update some dependencies manually, i.e. change

    classpath 'io.fabric.tools:gradle:1.25.1'

to

    classpath 'io.fabric.tools:gradle:1.27.0'

in my project's build.gradle file.

If you're using dagger you have to upgrade to version 2.20 or later.

This is because some libraries are not yet compatible with the AndroidX refactor as mentioned under Known issues in the AndroidX release notes.


I had been experiencing this problem while running assembleAndroidTest on Jenkins. The weirdest part was that this task ran sans any issues on my mac's terminal without any issues, but failed on Jenkins with-

Failed to transform file 'cucumber-java-1.2.5.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform

Had been looking for solutions for a couple of days now, having worked though different suggestions - none of which worked.

Finally, disabling Jetifier in gradle.properties resolved it for me.

android.enableJetifier=false