I want get RSS code from a URL with Retrofit
and if I enter url staticly in the get annotation everything is OK but with dynamic url I get an error.
My
(Kotlin) I solved here:
//@FormUrlEncoded // Don't used
@POST("orders")
fun saveOrders(@Body orders: Orders): Call<OrdersResponse>
It's way too late, but i just faced the same issue. I was using retrofit 2.5.0 with 'deferred' and 'await' on my retrofit interface and viewModel. And I read from retrofit github that from 2.6.0 deferred is deprecated and we can switch from deferred to 'suspend'. before i moved my retrofit version up, i just simply changed from deferred to suspend and run it, and got the same error. I solved it by moving my retrofit version from 2.5.0 to 2.6.0.
My point is that maybe there may be a chance that current retrofit version in your app doesn't support the way you use retrofit in your retrofit related classes or interfaces.
My problem was that I am using Kotlin coroutines and used 'suspend' in the Retrofit GET method. Just remove it and everything works fine.
I had the @Post
annotation but forgot the @Field
and @FormUrlEncoded
annotations
My problem was that I had the @POST
annotation, but forgot the @Body
annotation for the parameter.
You probably forgot to initialise adapter first, as mentioned in retrofit api:
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("https://api.github.com")
.build();
GitHubService service = restAdapter.create(GitHubService.class);
http://square.github.io/retrofit/