I am using Retrofit 2 library version 2.3.0 and all of a sudden it started replacing integer path parameters with zero instead of the actual number.
I am using Kotlin (1.2.21) and I have a method like:
@GET("posts/{postId}")
fun getPosts(@Path("postId") postId: Long): Single<Post>
This worked as should but now when I run my app on Android 6 (both a devices and an emulator) the postId
path parameter is always a zero i.e. posts/0
is called. Android 7 and 8 are fine. There was no change to the Retrofit and OkHttp versions, also the interface has not changed.
I have looked into the built request and the OkHttpCall
inside has args
array with one value of type Long
with value 0. This is only on Android 6, others have the correct value there. The ServiceMethod
has the correct URL set in the interface and it has one ParameterHandler
for the postId
of type BuiltInConverter.ToStringConverter
.
App is multiDexed and ProGuard is not used. What could be happening?
It was caused by the Instant Run. Retrofit works perfectly after I disabled it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With