解析json时报错default constructor not found. class.............
比如
public class MediaRepBean implements Parcelable {
/**
* id : 11852
* name : {"zh_CN":null,"en_US":null,"THIRD":null}
* sequence : 0
* cpobjectcode : 000208684474143085324
* mediaType : null
* duration : 4380
* videoType : null
* audioType : null
* streamType : null
* filePath :
* fileSize : 0
* subtitle :
* sid : 1
*/
public int id;
public Map<String,String> name;
public int sequence;
public String cpobjectcode;
public Object mediaType;
public int duration;
public Object videoType;
public Object audioType;
public Object streamType;
public String filePath;
public int fileSize;
public String subtitle;
public int sid;
public MediaRepBean() {
}
protected MediaRepBean(Parcel in) {
id = in.readInt();
name = in.readHashMap(HashMap.class.getClassLoader());
sequence = in.readInt();
cpobjectcode = in.readString();
mediaType = in.readString();
duration = in.readInt();
videoType = in.readString();
audioType = in.readString();
streamType = in.readString();
filePath = in.readString();
fileSize = in.readInt();
subtitle = in.readString();
sid = in.readInt();
}
public static final Creator<MediaRepBean> CREATOR = new Creator<MediaRepBean>() {
@Override
public MediaRepBean createFromParcel(Parcel in) {
return new MediaRepBean(in);
}
@Override
public MediaRepBean[] newArray(int size) {
return new MediaRepBean[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
dest.writeMap(name);
dest.writeInt(sequence);
dest.writeString(cpobjectcode);
dest.writeString(mediaType);
dest.writeInt(duration);
dest.writeString(videoType);
dest.writeString(audioType);
dest.writeString(streamType);
dest.writeString(filePath);
dest.writeInt(fileSize);
dest.writeString(subtitle);
dest.writeInt(sid);
}
}
必须加一个空的构造函数,不然会解析失败