1

I am using a third party library that has below two dependencies AndroidX:

implementation 'androidx.navigation:navigation-fragment:2.1.0-alpha02'
implementation 'androidx.navigation:navigation-ui:2.1.0-alpha02'

While compiling the host application, which still uses android.support.*, I got below error:

AAPT: error: attribute 'com.x.y.android.debug:defaultNavHost' not found.

AAPT: error: attribute 'com.x.y.android.debug:startDestination' not found.

To fix it, I added the respective AndroidX libraries in my host app and encountered below error:

Task :App:transformDexArchiveWithExternalLibsDexMergerForChaseDebug FAILED D8: Program type already present: com.google.android.material.internal.package-info

Please note: The library is already reverse-jetified using this link

./jetifier-standalone -r -i myAndroidXLib.aar -o supportLibVersion.aar

I have already tried adding below lines in gradle.properties file:

android.useAndroidX = true
android.enableJetifier=false

Already tried exluding from the packging-info:

packagingOptions {
     exclude 'com.google.android.material.internal.package-info'
}

Both the above solution didn't work at all. Any suggestions?

SKP
  • 410
  • 5
  • 20

1 Answers1

0

I can see two solutions:

1) Migrate your app to AndroidX.

2) Downgrade the library version

Most part of libraries are older than the AndroidX. So, in the past, they were using Support Library. They migrate recently. So, you can just set your gradle to use an older version (before they migrate to AndroidX).

You can find this kind of information by checking which version they updated the build.gradle.

For example, Lottie Library migrated to Android X in version 2.6.0 as you can see HERE

So, in case of Lottie, you could use the version v2.5.6 which was the last stable release before v2.6.0

guipivoto
  • 18,327
  • 9
  • 60
  • 75
  • Thanks for suggesting the solutions. However, migrating the app has a big risk factor which i am not planning to take at this point. And, downgrading the library is not possible as the library is already on v1.0.0. :( – SKP Aug 08 '19 at 18:07
  • Migrating to AndroidX should not be a problem. AndroidX is just the support library just with a different name. Could you please share a link to the library? – guipivoto Aug 08 '19 at 18:43