I am trying to convert a JsonArray of Strings using Seriazable (inside the Model class) but the app keeps crashing

AppComponent.java:11: error: [ComponentProcessor:MiscError] dagger.internal.codegen.ComponentProcessor was unable to process this interface because not all of its dependencies could be resolved. Check for compilation errors or a circular dependency with generated code.

This is an item from the list (retrofit). My problem comes when i try to parse the colours array

{
        "id": 12,
        "title": "Event",
        "start_date": 1557219638,
        "end_date": 1557222342,
        "workshop": {
            "id": 13,
            "title": "Event",
            "appearance": {
                "id": 1,
                "name": "Teal",
                "type": "Gradient",
                "colours": [
                    "#1da8b3",
                    "#4ac6d1"
                ]
            }
        }
}

and the model classes

@Entity(tableName = "Event")
data class Event(

    @PrimaryKey
    @SerializedName("id")
    var id: Int,

    @SerializedName("title")
    var title : String,

    @SerializedName("start_date")
    var startDate : Int,

    @SerializedName("end_date")
    var endDate : Int,
    @Embedded
    @SerializedName("workshop")
    var workshop: Workshop

) :Serializable {}

@Entity(tableName = "Workshop")
data class Workshop(

    @PrimaryKey
    @SerializedName("id")
    var idW: Int,

    @SerializedName("title")
    var titleW : String

    @Embedded
    @SerializedName("appearance")
    var appearance: Appearance
) : Serializable {
}

@Entity(tableName = "Appearance")
data class Appearance(

    @PrimaryKey
    @SerializedName("id")
    var id :Int,
    @SerializedName("name")
    var name : String,

    @SerializedName("type")
    var type :String,

    @ColumnInfo(name = "colours") //here is the problem
    var colours: List<String>

) :Serializable {

   constructor(): this(0,"","","", listOf(),0)
}

I don't know how to parse the colours[] in this point. Should I use another model class?

0 Answers