【发布时间】:2018-05-04 07:41:55
【问题描述】:
从 Gradle 2.x.x 升级到 Gradle 版本 3.1.2 后,retrofit2.Callback 无法解决。我在这样添加的子模块中使用 Retrofit:
api project(path: ':sdk', configuration: 'default')
sdk中的retrofit依赖是这样添加的:
api "com.squareup.retrofit2:retrofit:2.4.0"
我的错误信息是:
Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class ***, unresolved supertypes: retrofit2.Callback
IDE 没有向我显示类中的问题,即回调以某种方式丢失。 Android Studio 版本为 3.1.2。
到目前为止我尝试了什么:
- 清理 Gradle 缓存
- 项目的干净构建
- 将 Kotlin 更新到 1.2.41
【问题讨论】:
-
使用
implementation表示github.com/square/retrofit/issues/2752 -
@IntelliJAmiya 用
implementation尝试过。还是不行。 -
您是否尝试过工具栏左侧的 Gradle Sync 按钮?
-
@EpicPandaForce 你指的是哪个按钮?在 gradle 文件中更改某事后,我同步了 gradle 构建。
标签: android gradle kotlin retrofit retrofit2