У меня есть некоторый класс данных, который включает себя как список. Android студия показала следующую ошибку:
ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1ANTLR Runtime version 4.5.3 used for parser compilation does not match the current runtime version 4.7.1ANTLR Tool version 4.5.3 used for code generation does not match the current runtime version 4.7.1ANTLR Runtime version 4.5.3 used for parser compilation does not match the current runtime version 4.7.1C:\..\EventType.java:14: error: Cannot figure out how to save this field into database. You can consider adding a type converter for it.
private final java.util.List<...EventType> children = null;
Task :app:kaptDebugKotlin FAILED
^
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution
> java.lang.reflect.InvocationTargetException (no error message)
Класс данных
@Entity(tableName = "eventType")
data class EventType(
@PrimaryKey val id: Int,
val name: String,
val children: List<EventType>,
val minAge: Int = 0
)
Редактировать: Спасибо, следующий комментарий был полезен You have to use teh Room data type converter , look stackoverflow.com/questions/53085704/room-typeconverter – eurosecom