android ERROR: Unable to resolve dependency for xxx Could not resolve xxxx Disable offline mode and sync project

ERROR: Unable to resolve dependency for ':module-login@dev_repDebugAndroidTest/compileClasspath': Could not resolve androidx.work:work-runtime-ktx:[2.1.0].
Disable offline mode and sync project
Show Details
Affected Modules: module-login

一般是引用的包冲突了

搜索得知,我直接引用了:::androidx.work:work-runtime-ktx:2.3.4,但有些包间接引用了  androidx.work:work-runtime-ktx:[2.1.0].

运行 dependencies 

 可以打印整个APP的直接与间接引用 

 果然在这里找到了引用  

+--- androidx.work:work-testing:2.1.0
| +--- androidx.work:work-runtime-ktx:[2.1.0] -> 2.1.0

-------------在  androidx.work:work-testing:2.1.0 中 exclude 一下就好了

androidTestImplementation ('androidx.work:work-testing:2.1.0',{
//androidx.work:work-runtime-ktx:[2.1.0]
exclude group: 'androidx.work', module: 'work-runtime-ktx'
})


原文地址:https://www.cnblogs.com/caosq/p/13099904.html