java.lang. RuntimeException No Retrofit annotation found. (parameter #3)

China☆狼群 提交于 2019-12-02 02:26:14

java.lang.IllegalArgumentException: No Retrofit annotation found. (parameter #3)

As the error says, the problem is that the third parameter of the getWeather method does not have an annotation. The Callback class is used for the Call#enqueue(Callback) method.

Simply change sForecastClient.getWeather(latitude, longitude, callback) to sForecastClient.getWeather(latitude, longitude).enqueue(callback) and remove the third parameter.

Try it and modify your retrofit version number to 2.6.0。The use of coroutines in Retrofit 2.6.0 can return a Response object directly. If await() is not needed, Retrofit will automatically call it. This is not applicable when the version is below 2.6.0.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!