java - Retrofit 2.0 + GSON + Android: Unable to invoke no-args constructor for interface retrofit2.http.Body
问题描述
I am trying to create a simple News app with the following endpoint:
I know there are 2-3 questions already on SO about this but I belive that this exception is unique since it can not create a constructor for a library interace?!...
Here are my project files:
I get the following RuntimeException when trying to call
call.enqueue(new Callback<News>() {
In the main activity:
Unable to invoke no-args constructor for interface retrofit2.http.Body. Registering an InstanceCreator with Gson for this type may fix this problem.
So far I have tried:
Creating no-arg constructors for each of my model classes as mentioned in another similar question
Checking whether the any of the classes share similar names with the retrofit interace as mentioned here and here
Any idea what could cause this? I belive my code should be working and since the error is with a the retrofit2.http.Body
interface which to my knowledge I should not have to implement anywhere...
I really appreciate any form of help! Thanks!
解决方案
推荐阅读
- r - 从宽数据创建时间序列对象,按列值分组
- python - str.normalize 在熊猫中不做任何事情
- oracle - 如何在 Oracle 11.2 中模拟部分多列(复合)索引?
- raspberry-pi - 尝试将 RPi Zero W 用作 USB 键盘
- javascript - React.JS - 将数据从一个组件传递到另一个组件
- sql - SQL 计算组内有多少异常值
- sendgrid - 发送网格 - 取消预定的电子邮件
- javascript - Three.JS 天空盒不会出现。我在尺寸方面做错了吗
- qt - Qt 的 libsecret 等效项
- html - 在 Emscripten C++/wbasm 中,如何获得“页面关闭”事件