Retrofit 2.0 + GSON Unable to invoke no-args constructor for interface

前端 未结 3 870
借酒劲吻你
借酒劲吻你 2020-12-19 02:20

I\'m using Retrofit 2.0 in my app. Everything was quite good, but when I started request with no args, GSON returns:

Unable to invoke no-args constructor for         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-19 02:55

    You have the same name for interface (interface GetPhones) and model class (class GetPhones).

    I think you are using interface in this line:

    Call> getPhones();
    

    But it should be your model class. Check import section for it or rename model class to be sure that you are not mixing it.

提交回复
热议问题