'Failed to transform" error after migrating to AndroidX

前端 未结 5 898
我在风中等你
我在风中等你 2021-02-08 07:55

I\'m using Android Studio 3.2 Canary 14 and am trying to migrate an existing project to use AndroidX. It sounds from https://developer.android.com/topic/libraries/s

相关标签:
5条回答
  • 2021-02-08 08:36

    As per a statement on the AndroidX refactor made by a Google Engineer (Support Library) during the I/O session "What's New in Support Library?", Google already discovered bugs related to Jetifier in Android Studio 3.2 Canary 14.

    Thus, it is advised to wait until Canary 15 (to be released the coming week) before starting the AndroidX migration process.

    0 讨论(0)
  • 2021-02-08 08:48

    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.

    0 讨论(0)
  • 2021-02-08 08:50

    I had this same error after adding JDK 11 to my machine. It set itself as default JDK and this error started happening.

    After setting JDK 8 as default, it was fixed.

    0 讨论(0)
  • 2021-02-08 08:54

    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.

    0 讨论(0)
  • 2021-02-08 08:55

    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
    
    0 讨论(0)
提交回复
热议问题