Reputation: 2328
I am trying to retrieve a list of objects via Retrofit:
public interface TemplateApi {
@GET("/api/templates")
Observable<List<TemplateDto>> getList();
}
Here the Dto:
public class TemplateDto {
public String id;
public String name;
@Override
public String toString() {
return this.name;
}
}
Instead of the expected List I get a
List<LinkedTreeMap>
which leads to weird side effects (in my case toString() returns not what I would expect)
Upvotes: 1
Views: 647
Reputation: 2328
Ok I found it out - Android really does not have the flattest learning curve...
The issue was not with Retrofit or Gson itself but it was the minifier (Proguard). Proguard needs to be configured in a file which is called "proguard-rules.pro" by default.
Add the following lines:
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.myproject.dtos.** { *; }
Thanks to this answer.
Upvotes: 2