1

Let's say i have a public library module published to Maven Central and it is using the following dependencies:

implementation 'com.android.support:recyclerview-v7:28.0.0'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

Will this library work with no problems on Android X based projects?

GabrielBB
  • 2,479
  • 1
  • 35
  • 49

1 Answers1

1

Google has released a tool called Jetifier which migrates support-library-dependent libraries to rely on the equivalent AndroidX packages instead, so your libiary should work when Jetifier is enabled.

To enable Jetifier, make sure compileSdkVersion is set to API 28 or above and add the following lines in gradle.properties:

android.useAndroidX=true
android.enableJetifier=true
Matt
  • 2,953
  • 3
  • 27
  • 46
ZumiKua
  • 506
  • 4
  • 10
  • 1
    Nice! So you mean i should tell my library users to add "enableJetifier=true" to their app gradle.properties if they are using Android X. That way my library can work for everyone. What happens if i make my library using Android X? There is no way for someone using support-library to use it, right? – GabrielBB Nov 30 '18 at 04:25
  • Yes, I think so. AndroidX should not be used with support-library, so if you are using AndroidX then these support library user may not be able to use your library. – ZumiKua Nov 30 '18 at 05:18
  • Accepting answer – GabrielBB Nov 30 '18 at 13:33