在我的新的Kotlin项目中,为了实现Retrofit API调用,以下依赖项被添加到build.gradle
文件中。
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.
Studio指向错误行是,
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
请提供任何与IT技术相关的解决方案。
okhttpVersion
是如何定义/设置的? - undefined