我编写了一个具有以下依赖项的库:
implementation 'com.google.android.gms:play-services-safetynet:17.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.2'
在我的项目中,我决定添加这个库:
implementation 'com.mandarine.sdk:mandarine-library:2.0.1@aar'
但是由于在我的项目中我使用了与库中相同的依赖项,因此我决定将它们从主项目中删除并仅引用库中的那些,将库更改implementation为api. 我重建了这个库,更新了这个库在项目中的依赖,但是唉,项目不能使用这个库中的依赖。
我得到这样的东西: https ://gist.github.com/mnewlive/e0269a1f1b2a5062c6c16beb8329d268
清理项目,重建,我都试过了。我不明白catch是什么,因为实际上它应该这样工作,因为如果我通过一个模块添加我的库并build.grade在项目中编写以下内容:
implementation project(path: ':mandarine-library')
这一切都有效。
应该加
{ transitive = true }在implementation/api ('ТУТ_БИБЛИОТЕКА').事实证明,例如,像这样:
这样就表明可以使用库本身的依赖了。