我试图在 2.5.1-SNAPSHOT 中使用 Retrofit 的协程支持,但我不断遇到奇怪的异常。
我的改造服务类别有:
@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...
结果您还需要转换器工厂的 SNAPSHOT 版本。
com.squareup.retrofit2:converter-moshi:2.5.1-SNAPSHOT
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)