How to resolve conflict between Android support library and AndroidX?



I’m a unity developer that for solving conflict try to export my project to android studio.

I use both firebase and vungle library. firebase depends on androix-core and vungle depends on support-compat. if i compile both of them i receive compile error:

Duplicate class found in modules classes.jar (:androidx.core.core-1.0.0:) and support-compat-27.1.1.jar (support-compat-27.1.1.jar)

if i comment one of them i receive runtime error when game starts. what can i really do?



The answer given here points out that the best approach is to stick to AndroidX as is the new library to replace the Android Support, however using androidx in only means that your project is going to use AndroidX but if your classes over the project are still importing the Android Support libraries the same error is going to popup.

If you go to the vungle support site here, there is a section that talks about AndroidX compatibility and says:

AndroidX Compatibility
Vungle Android SDK 6.4.11 or earlier versions do not officially support AndroidX. Publishers must use migration tool that is available from Android Studio to transform the SDK and its dependencies (third-party libraries) for AndroidX compatibility. The official support for AndroidX will be available with 6.5.0 which is currently in early access stage, and that version would not need any further transformation to be AndroidX compatible. Please reach out through your Account Manager for early access to 6.5.0 if you needed.

So, you need to import your vungle library to Android Studio and follow the guides (this one), to migrate the entire project to AndroidX and then compile the library and use it over your Unity project. However, I must warn you that this is tricky, sometimes the migrating tool of Android Studio doesn’t change all the use cases of the Android Support and even sometimes it doesn’t update them to the current AndroidX classes, and you might have to go through each file of the library changing every android support reference to AndroidX, and that might take you days, depending on how big the library is.

OR, and this is a big or, you have to wait for the Vungle Android SDK 6.5.0 that will be compatible with AndroidX.

PD: As stated by Vungle support site, you can also get the current early access SDK of the Vungle 6.5.0, but that might contain bugs as it is still at development.

Answered By – Ronald Petit

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More