Kotlin 协程暂停乐趣 + 改造抛出"No Retrofit annotation found"错误



我正在尝试在2.5.1-snapshot中使用改造的Coroutine支持

我的改造服务类有:

@GET("weather")
suspend fun getForecast(@Query("q") query: String, @Query("num_of_days") numDays: String = "1",
                @Query("format") format : String = "json", @Query("key") apiKey: String = API_KEY)
        : Weather

当我尝试称呼它时,我得到了:

2019-05-18 13:57:01.507 27422-27477/com.my.app  E/MainPresenter$onResume$$inlined$CoroutineExceptionHandler: Something went wrong: No Retrofit annotation found. (parameter #5)
    for method WeatherService.getForecast

似乎很奇怪,因为错误是参数#5,但是只有4个参数。有人看过吗?

还请注意,这是针对带有

的调试构建
minifyEnabled false

所以我怀疑这是proguard ...

事实证明您还需要转换器工厂的快照版本。

com.squareup.retrofit2:converter-moshi:2.5.1-SNAPSHOT

您需要更新翻新,版本> 2'6

相关内容

最新更新