【发布时间】:2018-09-22 03:30:18
【问题描述】:
在 build.gradle 文件中添加了以下依赖项,用于在我的新 Kotlin 项目中实现 Retrofit API 调用。
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
implementation ("com.squareup.retrofit2:retrofit:$retrofitVersion"){
exclude module: 'okhttp'
}
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
同步后会显示如下错误。
Could not get unknown property 'okhttpVersion' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
工作室指向错误线是,
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
请给出任何解决方案。
【问题讨论】:
-
okhttpVersion是如何定义/设置的? -
@Nik 请不要将代码标签更改为引用错误日志
标签: android kotlin dependencies retrofit build.gradle