简体   繁体   English

Android X Projects可以使用使用支持库依赖项的库模块吗?

[英]Can Android X Projects use library modules that are using support-library dependencies?

Let's say i have a public library module published to Maven Central and it is using the following dependencies: 假设我有一个发布到Maven Central的公共库模块,它使用以下依赖项:

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? 这个库在基于Android X的项目上可以正常使用吗?

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. Google发布了一个名为Jetifier的工具,该工具可以迁移依赖于支持库的库,而改为依赖于等效的AndroidX软件包,因此,启用Jetifier时,您的库应该可以工作。

To enable Jetifier, make sure compileSdkVersion is set to API 28 or above and add the following lines in gradle.properties : 要启用Jetifier,请确保将compileSdkVersion设置为API 28或更高版本,并在gradle.properties中添加以下行:

android.useAndroidX=true
android.enableJetifier=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM