Service methods cannot return void. retrofit

前端 未结 4 1693
执念已碎
执念已碎 2020-12-09 01:30

This is my method in Interface. I am calling this function but app crash with this exception:

Caused by: java.lang.IllegalArgumentException: Service m

4条回答
  •  情深已故
    2020-12-09 02:09

    Based on your classes, it looks like you are using Retrofit 2.0.0, which is currently in beta. I think using a void in your service method is no longer allowed. Instead, return Call, which you can enqueue to perform the network call asynchronously.

    Alternatively, drop your library down to Retrofit 1.9.0 and replace your Retrofit class with RestAdapter.

提交回复
热议问题