I am creating an Entity (Room Persistence Library) class Food, where I want to make foodId as autoincrement.
foodId
@Entity class Food(var foodName: Str
You need to use the autoGenerate property
autoGenerate
Your primary key annotation should be like this:
@PrimaryKey(autoGenerate = true)
Reference for PrimaryKey.