android build_error ai_generated true

Failed to transform artifact 'support-v4.aar' using Jetifier. Reason: Cannot find a mapping for support class

ID: android/jetifier-transform-failed

Also available as: JSON · Markdown
82%Fix Rate
87%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
8 active

Root Cause

Jetifier cannot convert a legacy Android Support Library artifact to AndroidX. Unmapped class or corrupt dependency.

generic

Workarounds

  1. 92% success Find and replace the old support-library dependency with its AndroidX equivalent
    Replace 'com.android.support:support-v4:28.0.0' with 'androidx.legacy:legacy-support-v4:1.0.0'

    Sources: https://developer.android.com/reference/

  2. 88% success Run the AndroidX migration tool
    Android Studio: Refactor > Migrate to AndroidX; updates imports and gradle dependencies automatically
  3. 80% success Exclude the problematic transitive dependency
    implementation('com.example:lib:1.0') { exclude group: 'com.android.support', module: 'support-v4' }

Dead Ends

Common approaches that don't work:

  1. Disable Jetifier (android.enableJetifier=false) without migrating 88% fail

    Disabling Jetifier while support-library dependencies remain causes ClassNotFoundException at runtime.

  2. Manually repackage the AAR file with AndroidX namespaces 85% fail

    Fragile and error-prone. Updates to the library will require re-repackaging every time.