Android引用retrofit2 报错 Cannot access retrofit2.Call

我开发了一个基础模块A,里面用到了retrofit2的功能;

在其它模块要用A的时候,出现了报错 :Cannot access retrofit2.Call

原因:

A模块引用B模块

B模块引用C模块(这里的C模块是retrofit)

 

解决方法:

方法1:B模块修改gradle

在gradle 文件里面 
  implementation 'com.squareup.retrofit2:retrofit...

修改为:
  api 'com.squareup.retrofit2:retrofit...

方法2: 在A模块修改gradle

在gradle 文件里面 添加
  implementation 'com.squareup.retrofit2:retrofit...

posted @ 2022-05-07 09:44  蜜铀  阅读(264)  评论(0编辑  收藏  举报