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

后端 未结 2 866
孤城傲影
孤城傲影 2021-01-13 01:35

I\'m trying to update this RetroFit + Otto tutorial, so my code updated is:

IWeather.java

RetroFit 2.+ doesn\'t allow to return void

2条回答
  •  一个人的身影
    2021-01-13 02:17

    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.

提交回复
热议问题