Migrate to AndroidX

269 views Asked by At

I'm trying to migrate to AndroidX and we use this library in our project. However, this is currently causing an issue in our project:

Unable to resolve dependency for ':module@buildType/compileClasspath': Failed to transform file 'localytics-1.3.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform

Removing the library makes this issue disappear. Is there any workaround that would allow me to migrate to AndroidX til this library is migrated?

Per the documentation: https://developer.android.com/jetpack/androidx/migrate

I have updated my gradle.properties. The issue is not with setup, the issue is that localytics does not seem to support androidX. I want to confirm this if anyone knows since contacting them results in no answer (they have poor costumer service).

enter image description here

3

There are 3 answers

1
Martin Zeitler On BEST ANSWER

Someone posted a patch on Github:

  1. Clone the repository.
  2. Update the analytics-android-integration-localytics project to the latest Android updates, including AndroidX. Generate a jar file instead of an aar file. (This is the winning item here. It must be a jar file for it to work. An aar file isn't needed anyway since there aren't any resources in this project's aar file.)
  3. Remove the existing maven dependencies in the consuming project.
  4. Import the jar file as new module in the consuming project.
  5. Rebuild the consuming project.
1
Suman Kumar Dash On

First of all please add following line in gradle.properties

android.useAndroidX=true

android.enableJetifier=true

Can you please share your build.gradle ? May be there can have another issue. Please update the following localytics library like this.

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

classpath 'io.fabric.tools:gradle:1.27.0'
3
guipivoto On

If jetfier is not working on that library, I think you can try some workarounds such as:

  • Update the library (is v1.3.0 the latest version of that AAR?)

  • Disable jetfier as a whole (setting android.enableJetifier=false on gradle.properties)

  • Disable jetfier on that library only via:

on gradle.properties

android.enableJetifier=true
android.jetifier.blacklist = .*localytics.*
android.useAndroidX=true

This last option requires Android Gradle Plugin version