Unable to invoke no-args constructor for retrofit2.Call
See original GitHub issueVersion : retrofit 2.6.2 Json: GsonConverterFactory
When I use Call.awaitResponse() Call.await() hava error but I use Call.enqueue() Call.execute() no problem
java.lang.RuntimeException: Unable to invoke no-args constructor for retrofit2.Call. Registering an InstanceCreator with Gson for this type may fix this problem.
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:228)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:225)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:121)
at okhttp3.RealCall$AsyncCall.run(RealCall.kt:138)
at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:784)
Caused by: java.lang.UnsupportedOperationException: Interface can't be instantiated! Interface name: retrofit2.Call
at com.google.gson.internal.UnsafeAllocator.assertInstantiable(UnsafeAllocator.java:117)
at com.google.gson.internal.UnsafeAllocator$1.newInstance(UnsafeAllocator.java:49)
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:225)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:39)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:27)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:225)
at retrofit2.OkHttpCall$1.onResponse(OkHttpCall.java:121)
at okhttp3.RealCall$AsyncCall.run(RealCall.kt:138)
at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:784)
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Unable to invoke no-args constructor for retrofit2.Call
The problem is that you try to combine suspend with a Call<T> return type. When you use suspend you should make the Retrofit...
Read more >Gson 1.7: Unable to invoke no-args constructor for class org ...
Hello all, I though no-args constructors were no longer required in 1.7. Is there something about DateTimeZone that keeps this from working?
Read more >Retrofit 2.0 + GSON Unable to invoke no-args constructor for ...
Unable to invoke no -args constructor for interface com.example.project.API.GetPhones. Register an InstanceCreator with Gson for this type may fix this problem.
Read more >Hi. I have followed your article for implementing this code and ...
ava.lang.RuntimeException: Unable to invoke no-args constructor for retrofit2.Call<com.yourPackageName.model.SignUpResponse>.
Read more >Serialization of Java objects using Google's Gson library
Gson requires the class to have a default no-args constructor. If the no-args constructor is not provided, we can register an InstanceCreator with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

suspend fun(..): Call<..>I delete suspend to solve the problem Thank you very much!Please provide a complete failing test case or reproducing sample. Seems like you’re doing something like
Call<Call<..>>orsuspend fun(..): Call<..>.