I have so far implemented a Parcelable
class with AutoValue
and now I'd like to be able to deserialize it Gson
.
So I have found the AutoValue
Extension named auto-value-gson and I have tried to implement a class just like the examples on the github page.
So my class changed to :
@AutoValue
public abstract class UploadPhotoResponse implements Parcelable{
public abstract String getError();
public abstract UploadPhotoResponseNestedItem getPost();
public static Builder builder() {
return new AutoValue_UploadPhotoResponse.Builder();
}
@AutoValue.Builder
public static abstract class Builder {
public abstract Builder setError(String error);
public abstract Builder setPost(UploadPhotoResponseNestedItem post);
public abstract UploadPhotoResponse build();
}
// This is the new code I have added
public static TypeAdapter<UploadPhotoResponse> typeAdapter(Gson gson) {
return new AutoValue_UploadPhotoResponse.GsonTypeAdapter(gson);
}
}
but I'm getting error : "Cannot resolve symbol GsonTypeAdapter
"
I'm using the following dependencies (just in case something is missing) :
provided 'com.google.auto.value:auto-value:1.3'
apt 'com.google.auto.value:auto-value:1.3'
apt 'com.ryanharter.auto.value:auto-value-parcel:0.2.5'
apt 'com.ryanharter.auto.value:auto-value-gson:0.4.5'
provided 'com.ryanharter.auto.value:auto-value-gson:0.4.5'
annotationProcessor 'com.gabrielittner.auto.value:auto-value-with:1.0.0'