本人kotlin初学者,在用android studio时发现所有的@注解都无法识别,请问各位怎么解决这个问题
interface PlaceService {
@GET("v2'place?token=${SunnyWeatherApplication.TOKEN}&lang=zh_CN")
fun searchPlace(@Query("query") query: String): Call
}
data class Place(val name: String,val location: Location,
@SerializedName("formatted_address")val address: String)
这个问题可能是因为你没有在项目中添加对应的库文件造成的。
dependencies {
implementation "com.squareup.retrofit2:retrofit:2.9.0"
}
看看书中的依赖代码是否写全,然后清除缓存重新构建,有时候as抽风也这样